Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Amharic Infinite Loop for 568476685 and Other Large Numbers #598

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions num2words/lang_AM.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def merge(self, lpair, rpair):
return '%s %s' % (ltext, rtext), lnum + rnum
elif rnum > lnum:
return '%s %s' % (ltext, rtext), lnum * rnum
return ("%s, %s" % (ltext, rtext), lnum + rnum)

def to_ordinal(self, value):
self.verify_ordinal(value)
Expand Down
6 changes: 6 additions & 0 deletions tests/test_am.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ def test_cardinal(self):
self.assertEqual(num2words(100, lang='am'), 'መቶ')
self.assertEqual(num2words(100000, lang='am'), 'አንድ መቶ ሺህ')
self.assertEqual(num2words(101, lang='am'), 'አንድ መቶ አንድ')
self.assertEqual(num2words(568476685, lang='am'), 'አምስት መቶ ስድሳ ስምንት mሚሊዮን, አራት መቶ ሰባ ስድስት ሺህ, ስድስት መቶ ሰማኒያ አምስት')
self.assertEqual(num2words(56847, lang='am'), 'አምሳ ስድስት ሺህ, ስምንት መቶ አርባ ሰባት')
self.assertEqual(num2words(1111111111111111111, lang='am'), 'አንድ quintሚሊዮን, አንድ መቶ አሥራ አንድ quadrሚሊዮን, አንድ መቶ አሥራ አንድ trሚሊዮን, አንድ መቶ አሥራ አንድ bቢሊዮን, አንድ መቶ አሥራ አንድ mሚሊዮን, አንድ መቶ አሥራ አንድ ሺህ, አንድ መቶ አሥራ አንድ')
self.assertEqual(num2words(999999999, lang='am'), 'ዘጠኝ መቶ ዘጠና ዘጠኝ mሚሊዮን, ዘጠኝ መቶ ዘጠና ዘጠኝ ሺህ, ዘጠኝ መቶ ዘጠና ዘጠኝ')
self.assertEqual(num2words(29498237468376240, lang="am"), 'ሃያ ዘጠኝ quadrሚሊዮን, አራት መቶ ዘጠና ስምንት trሚሊዮን, ሁለት መቶ ሠላሳ ሰባት bቢሊዮን, አራት መቶ ስድሳ ስምንት mሚሊዮን, ሦስት መቶ ሰባ ስድስት ሺህ, ሁለት መቶ አርባ')
self.assertEqual(num2words(110110, lang='am'), 'አንድ መቶ አሥር ሺህ, አንድ መቶ አሥር')

def test_and_join_199(self):
self.assertEqual(num2words(199, lang='am'), 'አንድ መቶ ዘጠና ዘጠኝ')
Expand Down
Loading