mirror of
https://github.com/bblaz/num2words.git
synced 2025-12-06 06:42:25 +00:00
Fix bugs in the float precision and the currency, increase test coverage (#134)
* Fix some bugs in the float precision and the currency, increase test coverage. Ref: issue #112 #113 * Update README.rst
This commit is contained in:
committed by
GitHub
parent
5a131fedc6
commit
1c699d1bb4
@@ -20,6 +20,16 @@ from num2words import num2words
|
||||
|
||||
from . import test_es
|
||||
|
||||
TEST_CASES_TO_CURRENCY = (
|
||||
(1, 'un peso'),
|
||||
(2, 'dos pesos'),
|
||||
(8, 'ocho pesos'),
|
||||
(12, 'doce pesos'),
|
||||
(21, 'veintiun pesos'),
|
||||
(81.25, 'ochenta y un pesos y veinticinco centavos'),
|
||||
(100, 'cien pesos'),
|
||||
)
|
||||
|
||||
|
||||
class Num2WordsESCOTest(test_es.Num2WordsESTest):
|
||||
|
||||
@@ -33,3 +43,17 @@ class Num2WordsESCOTest(test_es.Num2WordsESTest):
|
||||
num2words(test[0], lang='es_CO', ordinal=True),
|
||||
test[1]
|
||||
)
|
||||
|
||||
def test_ordinal_num(self):
|
||||
for test in test_es.TEST_CASES_ORDINAL_NUM:
|
||||
self.assertEqual(
|
||||
num2words(test[0], lang='es', to='ordinal_num'),
|
||||
test[1]
|
||||
)
|
||||
|
||||
def test_currency(self):
|
||||
for test in TEST_CASES_TO_CURRENCY:
|
||||
self.assertEqual(
|
||||
num2words(test[0], lang='es_CO', to='currency'),
|
||||
test[1]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user