From 2c3422dc205dafacb3442c888500c440da59bc13 Mon Sep 17 00:00:00 2001 From: Kris Gesling Date: Thu, 7 Jan 2021 11:40:12 +0930 Subject: [PATCH 1/3] more it-it long form number tests --- test/test_format_it.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/test_format_it.py b/test/test_format_it.py index 23b81f68..b7f00a0b 100644 --- a/test/test_format_it.py +++ b/test/test_format_it.py @@ -181,6 +181,31 @@ def test_convert_hundreds(self): "ottocento novantaseimila seicento trentanove" " milioni, seicento trentunomila, ottocento" " novantatre") + self.assertEqual(pronounce_number(1000000000, lang="it"), + "Un miliardo") + self.assertEqual(pronounce_number(1000000001, lang="it"), + "Un miliardo, uno") + self.assertEqual(pronounce_number(1000000050, lang="it"), + "Un miliardo, cinquanta") + self.assertEqual(pronounce_number(1000123456, lang="it"), + "Un miliardo, cento ventri tre mila, " + "quattrocento cinquanta sei") + self.assertEqual(pronounce_number(1234567890, lang="it"), + "Un miliardo, due cento trenta quattro milioni, " + "cinquecento sessanta sette mila, ottocento novanta") + self.assertEqual(pronounce_number(1000000000000, lang="it"), + "Un bilione") + self.assertEqual(pronounce_number(1000000000001, lang="it"), + "Un bilione, uno") + self.assertEqual(pronounce_number(1000000500001, lang="it"), + "Un bilione, cinquecento mila, uno") + self.assertEqual(pronounce_number(1000000000000000, lang="it"), + "Un biliardo") + self.assertEqual(pronounce_number(1000000000000050, lang="it"), + "Un biliardo, cinquanta") + self.assertEqual(pronounce_number(1000000000123456, lang="it"), + "Un biliardo, cento venti tre mila, quattrocento " + "cinquanta sei") def test_convert_scientific_notation(self): """ From fd710344c6634168b9507dae473527cf223ce1aa Mon Sep 17 00:00:00 2001 From: ChanceNCounter Date: Sat, 10 Apr 2021 08:49:59 -0700 Subject: [PATCH 2/3] Update test/test_format_it.py fix typo per @Stypox Co-authored-by: Stypox --- test/test_format_it.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_format_it.py b/test/test_format_it.py index b7f00a0b..d4aa465b 100644 --- a/test/test_format_it.py +++ b/test/test_format_it.py @@ -188,7 +188,7 @@ def test_convert_hundreds(self): self.assertEqual(pronounce_number(1000000050, lang="it"), "Un miliardo, cinquanta") self.assertEqual(pronounce_number(1000123456, lang="it"), - "Un miliardo, cento ventri tre mila, " + "Un miliardo, cento venti tre mila, " "quattrocento cinquanta sei") self.assertEqual(pronounce_number(1234567890, lang="it"), "Un miliardo, due cento trenta quattro milioni, " From a1df117dd508dd11b9bb94da79fa05c3fcd4b048 Mon Sep 17 00:00:00 2001 From: Kris Gesling Date: Mon, 28 Feb 2022 16:45:58 +0930 Subject: [PATCH 3/3] Make large numbers easier to reason --- test/test_format_it.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/test_format_it.py b/test/test_format_it.py index d4aa465b..24a99ac0 100644 --- a/test/test_format_it.py +++ b/test/test_format_it.py @@ -181,29 +181,29 @@ def test_convert_hundreds(self): "ottocento novantaseimila seicento trentanove" " milioni, seicento trentunomila, ottocento" " novantatre") - self.assertEqual(pronounce_number(1000000000, lang="it"), + self.assertEqual(pronounce_number(10**9, lang="it"), "Un miliardo") - self.assertEqual(pronounce_number(1000000001, lang="it"), + self.assertEqual(pronounce_number(10**9 + 1, lang="it"), "Un miliardo, uno") - self.assertEqual(pronounce_number(1000000050, lang="it"), + self.assertEqual(pronounce_number(10**9 + 50, lang="it"), "Un miliardo, cinquanta") - self.assertEqual(pronounce_number(1000123456, lang="it"), + self.assertEqual(pronounce_number(10**9 + 123456, lang="it"), "Un miliardo, cento venti tre mila, " "quattrocento cinquanta sei") self.assertEqual(pronounce_number(1234567890, lang="it"), "Un miliardo, due cento trenta quattro milioni, " "cinquecento sessanta sette mila, ottocento novanta") - self.assertEqual(pronounce_number(1000000000000, lang="it"), + self.assertEqual(pronounce_number(10**12, lang="it"), "Un bilione") - self.assertEqual(pronounce_number(1000000000001, lang="it"), + self.assertEqual(pronounce_number(10**12 + 1, lang="it"), "Un bilione, uno") - self.assertEqual(pronounce_number(1000000500001, lang="it"), + self.assertEqual(pronounce_number(10**12 + 5*10**6 + 1, lang="it"), "Un bilione, cinquecento mila, uno") - self.assertEqual(pronounce_number(1000000000000000, lang="it"), + self.assertEqual(pronounce_number(10**15, lang="it"), "Un biliardo") - self.assertEqual(pronounce_number(1000000000000050, lang="it"), + self.assertEqual(pronounce_number(10**15 + 50, lang="it"), "Un biliardo, cinquanta") - self.assertEqual(pronounce_number(1000000000123456, lang="it"), + self.assertEqual(pronounce_number(10**15 + 123456, lang="it"), "Un biliardo, cento venti tre mila, quattrocento " "cinquanta sei")