From 9b62e333d769acfb634b251187648309f3597269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0smail=20Eski?= Date: Tue, 12 Oct 2021 10:09:49 +0300 Subject: [PATCH 1/5] [ADD] to ordinal number for Turkish --- num2words/lang_TR.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/num2words/lang_TR.py b/num2words/lang_TR.py index 7fba871..59393c2 100644 --- a/num2words/lang_TR.py +++ b/num2words/lang_TR.py @@ -806,6 +806,10 @@ class Num2Word_TR(Num2Word_Base): 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: From 8633c0baf2cc5c38cc9caa2c06c1660f15edd824 Mon Sep 17 00:00:00 2001 From: ismail eski Date: Wed, 17 Aug 2022 18:09:07 +0300 Subject: [PATCH 2/5] [FIX] /num2words/lang_TR.py:812:1: W293 blank line contains whitespace --- num2words/lang_TR.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/num2words/lang_TR.py b/num2words/lang_TR.py index 59393c2..ee1d6d4 100644 --- a/num2words/lang_TR.py +++ b/num2words/lang_TR.py @@ -809,7 +809,7 @@ class Num2Word_TR(Num2Word_Base): 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: From 3187fa2e055234c8e23cea3eac7405dc9888164a Mon Sep 17 00:00:00 2001 From: ismail eski Date: Wed, 17 Aug 2022 19:11:37 +0300 Subject: [PATCH 3/5] [TEST] ordinal_num test --- tests/test_tr.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_tr.py b/tests/test_tr.py index 8425262..2da7001 100644 --- a/tests/test_tr.py +++ b/tests/test_tr.py @@ -183,6 +183,10 @@ class Num2WordsTRTest(TestCase): "expected": u"yüzbirmilyaryüzbirmilyononbirbinonvirgüliki"}, {"test": 101101011010.2, "to": "cardinal", "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: From c19ea1314598af17f02dcfacc9fe6b262fd282e6 Mon Sep 17 00:00:00 2001 From: ismail eski Date: Wed, 17 Aug 2022 19:56:11 +0300 Subject: [PATCH 4/5] [TEST] ordinal_num test --- tests/test_tr.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_tr.py b/tests/test_tr.py index 2da7001..d01ba06 100644 --- a/tests/test_tr.py +++ b/tests/test_tr.py @@ -182,10 +182,10 @@ class Num2WordsTRTest(TestCase): {"test": 101101011010.02, "to": "cardinal", "expected": u"yüzbirmilyaryüzbirmilyononbirbinonvirgüliki"}, {"test": 101101011010.2, "to": "cardinal", - "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ü"} + "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ı"} ] From a05f6e5c1d626ddff7f9de0d196ab28915980ffc Mon Sep 17 00:00:00 2001 From: ismail eski Date: Thu, 18 Aug 2022 18:48:10 +0300 Subject: [PATCH 5/5] [FIX] E231 missing whitespace after ',' --- tests/test_tr.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_tr.py b/tests/test_tr.py index d01ba06..e1aefba 100644 --- a/tests/test_tr.py +++ b/tests/test_tr.py @@ -184,9 +184,9 @@ class Num2WordsTRTest(TestCase): {"test": 101101011010.2, "to": "cardinal", "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ı"} + {"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: