Skip to content

Commit 3018228

Browse files
authored
bpo-42224: Fix test_format when locale does not expect number grouping (GH-23067)
1 parent 64366fa commit 3018228

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
@@ -428,13 +428,16 @@ def test_locale(self):
428428
localeconv = locale.localeconv()
429429
sep = localeconv['thousands_sep']
430430
point = localeconv['decimal_point']
431+
grouping = localeconv['grouping']
431432

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

436438
text = format(1234.5, "n")
437-
self.assertIn(sep, text)
439+
if grouping:
440+
self.assertIn(sep, text)
438441
self.assertIn(point, text)
439442
self.assertEqual(text.replace(sep, ''), '1234' + point + '5')
440443
finally:

0 commit comments

Comments
 (0)