mirror of
https://github.com/bblaz/num2words.git
synced 2025-12-06 06:42:25 +00:00
Add more tests to cover num2words/base.py
Fix: - https://github.com/savoirfairelinux/num2words/issues/125 Signed-off-by: William José Moreno Reyes <williamjmorenor@gmail.com>
This commit is contained in:
@@ -32,3 +32,29 @@ class Num2WordBaseTest(TestCase):
|
|||||||
def test_to_currency_not_implemented(self):
|
def test_to_currency_not_implemented(self):
|
||||||
with self.assertRaises(NotImplementedError):
|
with self.assertRaises(NotImplementedError):
|
||||||
self.base.to_currency(Decimal('1.00'), currency='EUR')
|
self.base.to_currency(Decimal('1.00'), currency='EUR')
|
||||||
|
|
||||||
|
def test_error_to_cardinal_float(self):
|
||||||
|
from num2words.base import Num2Word_Base
|
||||||
|
with self.assertRaises(TypeError):
|
||||||
|
Num2Word_Base.to_cardinal_float(9)
|
||||||
|
with self.assertRaises(TypeError):
|
||||||
|
Num2Word_Base.to_cardinal_float("a")
|
||||||
|
|
||||||
|
def test_error_merge(self):
|
||||||
|
from num2words.base import Num2Word_Base
|
||||||
|
self.base = Num2Word_Base()
|
||||||
|
with self.assertRaises(NotImplementedError):
|
||||||
|
self.base.merge(2, 3)
|
||||||
|
|
||||||
|
def test_is_title(self):
|
||||||
|
from num2words.base import Num2Word_Base
|
||||||
|
self.base = Num2Word_Base()
|
||||||
|
self.assertEqual(
|
||||||
|
self.base.title(9),
|
||||||
|
9
|
||||||
|
)
|
||||||
|
self.base.is_title = True
|
||||||
|
self.assertEqual(
|
||||||
|
self.base.title("ii"),
|
||||||
|
"Ii"
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user