mirror of
https://github.com/bblaz/num2words.git
synced 2025-12-06 06:42:25 +00:00
Add tests for italian language currencies
This commit is contained in:
committed by
Willem Van Onsem
parent
3dda6ee22e
commit
593435f21a
@@ -21,6 +21,36 @@ from unittest import TestCase
|
|||||||
|
|
||||||
from num2words import num2words
|
from num2words import num2words
|
||||||
|
|
||||||
|
TEST_CASES_TO_CURRENCY_EUR = (
|
||||||
|
(1.00, 'un euro e zero centesimi'),
|
||||||
|
(2.01, 'due euro e un centesimo'),
|
||||||
|
(8.10, 'otto euro e dieci centesimi'),
|
||||||
|
(12.26, 'dodici euro e ventisei centesimi'),
|
||||||
|
(21.29, 'ventun euro e ventinove centesimi'),
|
||||||
|
(81.25, 'ottantun euro e venticinque centesimi'),
|
||||||
|
(100.00, 'cento euro e zero centesimi'),
|
||||||
|
)
|
||||||
|
|
||||||
|
TEST_CASES_TO_CURRENCY_USD = (
|
||||||
|
(1.00, 'un dollaro e zero centesimi'),
|
||||||
|
(2.01, 'due dollari e un centesimo'),
|
||||||
|
(8.10, 'otto dollari e dieci centesimi'),
|
||||||
|
(12.26, 'dodici dollari e ventisei centesimi'),
|
||||||
|
(21.29, 'ventun dollari e ventinove centesimi'),
|
||||||
|
(81.25, 'ottantun dollari e venticinque centesimi'),
|
||||||
|
(100.00, 'cento dollari e zero centesimi'),
|
||||||
|
)
|
||||||
|
|
||||||
|
TEST_CASES_TO_CURRENCY_GBP = (
|
||||||
|
(1.00, 'una sterlina e zero penny'),
|
||||||
|
(2.01, 'due sterline e un penny'),
|
||||||
|
(8.10, 'otto sterline e dieci penny'),
|
||||||
|
(12.26, 'dodici sterline e ventisei penny'),
|
||||||
|
(21.29, 'ventun sterline e ventinove penny'),
|
||||||
|
(81.25, 'ottantun sterline e venticinque penny'),
|
||||||
|
(100.00, 'cento sterline e zero penny'),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Num2WordsITTest(TestCase):
|
class Num2WordsITTest(TestCase):
|
||||||
maxDiff = None
|
maxDiff = None
|
||||||
@@ -240,3 +270,24 @@ class Num2WordsITTest(TestCase):
|
|||||||
self.assertAlmostEqual(
|
self.assertAlmostEqual(
|
||||||
num2words(1.1, lang="it"), "uno virgola uno"
|
num2words(1.1, lang="it"), "uno virgola uno"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_currency_eur(self):
|
||||||
|
for test in TEST_CASES_TO_CURRENCY_EUR:
|
||||||
|
self.assertEqual(
|
||||||
|
num2words(test[0], lang='it', to='currency', currency='EUR'),
|
||||||
|
test[1]
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_currency_usd(self):
|
||||||
|
for test in TEST_CASES_TO_CURRENCY_USD:
|
||||||
|
self.assertEqual(
|
||||||
|
num2words(test[0], lang='it', to='currency', currency='USD'),
|
||||||
|
test[1]
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_currency_gbp(self):
|
||||||
|
for test in TEST_CASES_TO_CURRENCY_GBP:
|
||||||
|
self.assertEqual(
|
||||||
|
num2words(test[0], lang='it', to='currency', currency='GBP'),
|
||||||
|
test[1]
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user