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:
Ernesto Rodriguez Ortiz
2017-11-06 20:19:26 -05:00
committed by GitHub
parent 5a131fedc6
commit 1c699d1bb4
15 changed files with 158 additions and 92 deletions

View File

@@ -20,6 +20,16 @@ from num2words import num2words
from . import test_es
TEST_CASES_TO_CURRENCY = (
(1, 'un bolívar'),
(2, 'dos bolívares'),
(8, 'ocho bolívares'),
(12, 'doce bolívares'),
(21, 'veintiun bolívares'),
(81.25, 'ochenta y un bolívares y veinticinco centavos'),
(100, 'cien bolívares'),
)
class Num2WordsESVETest(test_es.Num2WordsESTest):
@@ -33,3 +43,17 @@ class Num2WordsESVETest(test_es.Num2WordsESTest):
num2words(test[0], lang='es_VE', 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_VE', to='currency', old=True),
test[1]
)