You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When passing in a string parameter, it's expected to be handled the same as if an integer parameter was passed.
Actual Behaviour
Because the input gets turned into a Decimal in init if it's a string, this causes failures in any language implementation that assumes the input will be an integer.
Specifically I ran into an issue with the Italian converter - it attempts to perform arithmetic on the input, and then use those results to index the word arrays. However, because those arithmetic results are Decimal and not int, it throws an error.
TypeError: list indices must be integers or slices, not decimal.Decimal
I haven't tested any other languages, but they may have a similar problem. Notably this issue doesn't exist for the en implementation.
Steps to reproduce
Pass in any string input to the Italian converter.
Expected Behaviour
When passing in a string parameter, it's expected to be handled the same as if an integer parameter was passed.
Actual Behaviour
Because the input gets turned into a Decimal in init if it's a string, this causes failures in any language implementation that assumes the input will be an integer.
Specifically I ran into an issue with the Italian converter - it attempts to perform arithmetic on the input, and then use those results to index the word arrays. However, because those arithmetic results are Decimal and not int, it throws an error.
TypeError: list indices must be integers or slices, not decimal.Decimal
I haven't tested any other languages, but they may have a similar problem. Notably this issue doesn't exist for the
en
implementation.Steps to reproduce
Pass in any string input to the Italian converter.
num2words.num2words(str(34234), lang='it', to='cardinal')
The text was updated successfully, but these errors were encountered: