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

Fixes #435 [pt_BR] Issue with the hundreds of millions, billions, ... when the hundreds of those are exact. #436

Merged
merged 9 commits into from
Aug 19, 2022
2 changes: 1 addition & 1 deletion num2words/lang_PT_BR.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def merge(self, curr, next):
if nnum < 1000000:
return next
ctext = "um"
elif cnum == 100 and not nnum == 1000:
elif cnum == 100 and nnum % 1000 != 0:
ctext = "cento"

if nnum < cnum:
Expand Down
6 changes: 6 additions & 0 deletions tests/test_pt_BR.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ def test_cardinal_integer(self):
self.assertEqual(
num2words(6000000, lang='pt_BR'), 'seis milhões'
)
self.assertEqual(
num2words(100000000, lang='pt_BR'), 'cem milhões'
)
self.assertEqual(
num2words(100000000000, lang='pt_BR'), 'cem bilhões'
)
self.assertEqual(
num2words(19000000000, lang='pt_BR'), 'dezenove bilhões'
)
Expand Down