[Python-checkins] bpo-42224: Fix test_format when locale does not expect number grouping (GH-23067)

miss-islington webhook-mailer at python.org
Mon Nov 2 10:46:09 EST 2020


https://github.com/python/cpython/commit/1e96de9ed4b1ca96d345b7e309a8fe3802638f4a
commit: 1e96de9ed4b1ca96d345b7e309a8fe3802638f4a
branch: 3.8
author: Miss Skeleton (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2020-11-02T07:46:00-08:00
summary:

bpo-42224: Fix test_format when locale does not expect number grouping (GH-23067)

(cherry picked from commit 301822859b3fc34801a06f1090d62f9f2ee5b092)

Co-authored-by: Lysandros Nikolaou <lisandrosnik at gmail.com>

files:
M Lib/test/test_format.py

diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py
index 4559cd5623efe..2dd9ca52545cc 100644
--- a/Lib/test/test_format.py
+++ b/Lib/test/test_format.py
@@ -427,13 +427,16 @@ def test_locale(self):
             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:



More information about the Python-checkins mailing list