add Thai Language from Thailand (#139)

* add Thai

* change splitby3 to splitbyx

* change lang_th to use function from currency

* make Num2Word_TH inherit from Num2Word_Base

* comment out test failed in 2.7 env

* fix python2.7 error

* add USD EUR for Thai

* pep8 fix

* added Thai
This commit is contained in:
pipech
2017-12-14 23:48:12 +07:00
committed by Ernesto Rodriguez Ortiz
parent efce631944
commit ab54bed93a
14 changed files with 1442 additions and 1025 deletions

24
tests/test_utils.py Normal file
View File

@@ -0,0 +1,24 @@
from unittest import TestCase
from num2words.utils import splitbyx
class TestUtils(TestCase):
def test_splitbyx(self):
self.assertEqual(list(splitbyx(str(12), 3)), [12])
self.assertEqual(list(splitbyx(str(1234), 3)), [1, 234])
self.assertEqual(list(splitbyx(str(12345678900), 3)),
[12, 345, 678, 900]
)
self.assertEqual(list(splitbyx(str(1000000), 6)), [1, 0])
self.assertEqual(list(splitbyx(str(12), 3, format_int=False)), ['12'])
self.assertEqual(list(splitbyx(str(1234), 3, format_int=False)),
['1', '234']
)
self.assertEqual(list(splitbyx(str(12345678900), 3, format_int=False)),
['12', '345', '678', '900']
)
self.assertEqual(list(splitbyx(str(1000000), 6, format_int=False)),
['1', '000000']
)