Skip to content

Commit

Permalink
bpo-42224: Fix test_format when locale does not expect number grouping (
Browse files Browse the repository at this point in the history
  • Loading branch information
lysnikolaou committed Nov 2, 2020
1 parent 64366fa commit 3018228
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Lib/test/test_format.py
Expand Up @@ -428,13 +428,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:
Expand Down

0 comments on commit 3018228

Please sign in to comment.