Very naive to_currency implementation for NL

This commit is contained in:
Mārtiņš Šulcs
2018-09-18 10:46:36 +03:00
parent 23902ab7c5
commit 03d44f4bc3
2 changed files with 50 additions and 17 deletions

View File

@@ -64,3 +64,26 @@ class Num2WordsNLTest(TestCase):
def test_ordinal_for_floating_numbers(self):
self.assertRaises(TypeError, num2words, 2.453, ordinal=True, lang='nl')
def test_to_currency(self):
self.assertEqual(
num2words('38.4', lang='nl', to='currency', seperator=' en',
cents=False, currency='EUR'),
"achtendertig euro en 40 cent"
)
self.assertEqual(
num2words('0', lang='nl', to='currency', seperator=' en',
cents=False, currency='EUR'),
"nul euro en 00 cent"
)
self.assertEqual(
num2words('1.01', lang='nl', to='currency', seperator=' en',
cents=True, currency='EUR'),
"één euro en één cent"
)
self.assertEqual(
num2words('4778.00', lang='nl', to='currency', seperator=' en',
cents=True, currency='EUR'),
'vierduizendzevenhonderdachtenzeventig euro en nul cent')