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

(cherry picked from commit 301822859b)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
This commit is contained in:
Miss Skeleton (bot) 2020-11-02 07:46:00 -08:00 committed by GitHub
parent ad37c66adc
commit 1e96de9ed4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -427,13 +427,16 @@ class FormatTest(unittest.TestCase):
localeconv = locale.localeconv() localeconv = locale.localeconv()
sep = localeconv['thousands_sep'] sep = localeconv['thousands_sep']
point = localeconv['decimal_point'] point = localeconv['decimal_point']
grouping = localeconv['grouping']
text = format(123456789, "n") text = format(123456789, "n")
self.assertIn(sep, text) if grouping:
self.assertIn(sep, text)
self.assertEqual(text.replace(sep, ''), '123456789') self.assertEqual(text.replace(sep, ''), '123456789')
text = format(1234.5, "n") text = format(1234.5, "n")
self.assertIn(sep, text) if grouping:
self.assertIn(sep, text)
self.assertIn(point, text) self.assertIn(point, text)
self.assertEqual(text.replace(sep, ''), '1234' + point + '5') self.assertEqual(text.replace(sep, ''), '1234' + point + '5')
finally: finally: