Skip to content

Commit 1e96de9

Browse files
bpo-42224: Fix test_format when locale does not expect number grouping (GH-23067)
(cherry picked from commit 3018228) Co-authored-by: Lysandros Nikolaou <[email protected]>
1 parent ad37c66 commit 1e96de9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Lib/test/test_format.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -427,13 +427,16 @@ def test_locale(self):
427427
localeconv = locale.localeconv()
428428
sep = localeconv['thousands_sep']
429429
point = localeconv['decimal_point']
430+
grouping = localeconv['grouping']
430431

431432
text = format(123456789, "n")
432-
self.assertIn(sep, text)
433+
if grouping:
434+
self.assertIn(sep, text)
433435
self.assertEqual(text.replace(sep, ''), '123456789')
434436

435437
text = format(1234.5, "n")
436-
self.assertIn(sep, text)
438+
if grouping:
439+
self.assertIn(sep, text)
437440
self.assertIn(point, text)
438441
self.assertEqual(text.replace(sep, ''), '1234' + point + '5')
439442
finally:

0 commit comments

Comments
 (0)