Skip to content

Commit

Permalink
Merge pull request #468 from ieski/master
Browse files Browse the repository at this point in the history
[ADD] to ordinal number for Turkish
  • Loading branch information
mrodriguezg1991 authored Aug 18, 2022
2 parents 18b0007 + a05f6e5 commit 48dd5bd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions num2words/lang_TR.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,10 @@ def to_ordinal(self, value):

return wrd

def to_ordinal_num(self, value):
self.verify_ordinal(value)
return "%s%s" % (value, self.to_ordinal(value)[-4:])

def to_splitnum(self, val):
float_digits = str(int(val * 10 ** self.precision))
if not int(val) == 0:
Expand Down
6 changes: 5 additions & 1 deletion tests/test_tr.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ def test_tr(self):
{"test": 101101011010.02, "to": "cardinal",
"expected": u"yüzbirmilyaryüzbirmilyononbirbinonvirgüliki"},
{"test": 101101011010.2, "to": "cardinal",
"expected": u"yüzbirmilyaryüzbirmilyononbirbinonvirgülyirmi"}
"expected": u"yüzbirmilyaryüzbirmilyononbirbinonvirgülyirmi"},
{"test": 10, "to": "ordinal_num", "expected": u"10uncu"},
{"test": 1, "to": "ordinal_num", "expected": u"1inci"},
{"test": 3, "to": "ordinal_num", "expected": u"3üncü"},
{"test": 6, "to": "ordinal_num", "expected": u"6ıncı"}
]

for casedata in testcases:
Expand Down

0 comments on commit 48dd5bd

Please sign in to comment.