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

Add USD currency support to RU language #211

Merged
merged 2 commits into from
Oct 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions num2words/lang_RU.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ class Num2Word_RU(Num2Word_Base):
'EUR': (
('евро', 'евро', 'евро'), ('цент', 'цента', 'центов')
),
'USD': (
('доллар', 'доллара', 'долларов'), ('цент', 'цента', 'центов')
),
}

def setup(self):
Expand Down
13 changes: 13 additions & 0 deletions tests/test_ru.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,16 @@ def test_to_currency(self):
cents=False, currency='EUR'),
"тридцать восемь евро и 40 центов"
)
self.assertEqual(
num2words('1230.56', lang='ru', to='currency', currency='USD'),
'одна тысяча двести тридцать долларов, пятьдесят шесть центов'
)
self.assertEqual(
num2words('1231.56', lang='ru', to='currency', currency='USD'),
'одна тысяча двести тридцать один доллар, пятьдесят шесть центов'
)
self.assertEqual(
num2words('1234.56', lang='ru', to='currency', currency='USD'),
'одна тысяча двести тридцать четыре доллара, пятьдесят шесть '
'центов'
)