]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-42224: Fix test_format when locale does not expect number grouping (GH-23067)
authorMiss Skeleton (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 2 Nov 2020 15:46:00 +0000 (07:46 -0800)
committerGitHub <noreply@github.com>
Mon, 2 Nov 2020 15:46:00 +0000 (07:46 -0800)
(cherry picked from commit 301822859b3fc34801a06f1090d62f9f2ee5b092)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Lib/test/test_format.py

index 4559cd5623efe9ffc2f6ab3bd10e3b6c56a3b424..2dd9ca52545cc24652984246c40767b9858bf68c 100644 (file)
@@ -427,13 +427,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: