Skip to content

Commit

Permalink
Add more tests to cover num2words/base.py
Browse files Browse the repository at this point in the history
Fix:
 - #125

Signed-off-by: William José Moreno Reyes <williamjmorenor@gmail.com>
  • Loading branch information
williamjmorenor committed Oct 26, 2019
1 parent 95272ed commit c837485
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,29 @@ def setUpClass(cls):
def test_to_currency_not_implemented(self):
with self.assertRaises(NotImplementedError):
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"
)

0 comments on commit c837485

Please sign in to comment.