Skip to content

Conversation

@cheng-jess
Copy link
Contributor

@cheng-jess cheng-jess commented Dec 2, 2024

Fixes #591 by eliminating infinite loop

Changes proposed in this pull request:

  • Added return statement in merge function after the elifs to ensure that recursive combinations are resolved properly. Any situation not explicitly handled by the existing conditions will be covered by the added return statement, which will prevent the merge logic from entering an undefined or recursive state.
  • Added tests in tests_am.py to ensure the bug was fixed as well as added additional tests to ensure proper handling of large numbers and ones with irregular splits in the Amharic language.

Status

  • READY
  • HOLD
  • WIP (Work-In-Progress)

How to verify this change

Test with num2words(568476685, lang="am") or "num2words 568476685 -l am" in the command line. Can also run the test_am.py file to check with test case/assert statement.

Additional notes

Fixed Issue #591

@cheng-jess
Copy link
Contributor Author

@mrodriguezg1991
Per Mohammed's email, I'm tagging you so that you can review it. Thank you.

mrodriguezg1991 pushed a commit that referenced this pull request Jan 14, 2025
* Update base.py to remove cents from displaying when whole number inputted

* Update test_en.py to align with updated base.py

* Update test_en_ng.py to align with updated base.py

* Update test_hu.py to align with updated base.py

* Update test_nl.py to align with updated base.py

* Update test_am.py to align with updated base.py

* Remove Amharic cardinals test cases meant for other PR (#598) and fix
formatting

---------

Co-authored-by: cheng-jess <[email protected]>
@elishowk
Copy link

elishowk commented Apr 1, 2025

Hi @cheng-jess, do you plan to fix the tests failing only for a style issue (with flake8 "line too long") ?
I'm really interested in seeing this bug fixed too.
Cheers and thanks so much.

@cheng-jess
Copy link
Contributor Author

Hi @elishowk, I'm not planning on fixing the style issue right now, so feel free to work on it if you'd like. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calling num2words(568476685, lang="am") results in an infinite loop

3 participants