Skip to content

Commit

Permalink
Add test to improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Marlon Rodriguez Garcia committed Nov 19, 2024
1 parent 8c712e9 commit 7d289e2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,27 @@ def test_is_title(self):
self.base.title("one"),
"one"
)

def test_set_high_numwords_not_implemented(self):
with self.assertRaises(NotImplementedError):
self.base.set_high_numwords()

def test_to_ordinal_num(self):
from num2words.base import Num2Word_Base
self.base = Num2Word_Base()
self.assertEqual(
self.base.to_ordinal_num(1),
1
)
self.assertEqual(
self.base.to_ordinal_num(100),
100
)
self.assertEqual(
self.base.to_ordinal_num(1000),
1000
)

def test_pluralize_not_implemented(self):
with self.assertRaises(NotImplementedError):
self.base.pluralize(n=None, forms=None)
8 changes: 8 additions & 0 deletions tests/test_dk.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from unittest import TestCase

from num2words import num2words
from num2words.lang_DK import Num2Word_DK


class Num2WordsDKTest(TestCase):
Expand All @@ -35,3 +36,10 @@ def test_cardinal(self):
self.assertEqual(num2words(8, to="cardinal", lang="dk"), "otte")
self.assertEqual(num2words(18, to="cardinal", lang="dk"), "atten")
self.assertEqual(num2words(45, to="cardinal", lang="dk"), "femogfyrre")

def test_to_ordinal_num(self):
num2words_dk = Num2Word_DK()
self.assertEqual(num2words_dk.to_ordinal_num(1), "1te")
self.assertEqual(num2words_dk.to_ordinal_num(2), "2en")
self.assertEqual(num2words_dk.to_ordinal_num(5), "5te")
self.assertEqual(num2words_dk.to_ordinal_num(10), "10ende")

0 comments on commit 7d289e2

Please sign in to comment.