summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLysandros Nikolaou <lisandrosnik@gmail.com>2020-11-02 15:51:56 (GMT)
committerGitHub <noreply@github.com>2020-11-02 15:51:56 (GMT)
commit723e21a8e79815ae77474d1f21b9847b9c9bdbeb (patch)
tree8c950f4955725e30da47a7fdcac8d2a22c66d1d6
parentff852aabf22908e7ef0325af65bab5d02c421fd8 (diff)
downloadcpython-723e21a8e79815ae77474d1f21b9847b9c9bdbeb.zip
cpython-723e21a8e79815ae77474d1f21b9847b9c9bdbeb.tar.gz
cpython-723e21a8e79815ae77474d1f21b9847b9c9bdbeb.tar.bz2
bpo-42224: Fix test_format when locale does not expect number grouping (GH-23067)
(cherry picked from commit 301822859b3fc34801a06f1090d62f9f2ee5b092)
-rw-r--r--Lib/test/test_format.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py
index d2744cd..9653e46 100644
--- a/Lib/test/test_format.py
+++ b/Lib/test/test_format.py
@@ -428,13 +428,16 @@ class FormatTest(unittest.TestCase):
localeconv = locale.localeconv()
sep = localeconv['thousands_sep']
point = localeconv['decimal_point']
+ grouping = localeconv['grouping']
text = format(123456789, "n")
- self.assertIn(sep, text)
+ if grouping:
+ self.assertIn(sep, text)
self.assertEqual(text.replace(sep, ''), '123456789')
text = format(1234.5, "n")
- self.assertIn(sep, text)
+ if grouping:
+ self.assertIn(sep, text)
self.assertIn(point, text)
self.assertEqual(text.replace(sep, ''), '1234' + point + '5')
finally: