From 2b23a338466070462ed198e402fb7187684f8c75 Mon Sep 17 00:00:00 2001 From: Lysandros Nikolaou Date: Mon, 2 Nov 2020 17:27:30 +0200 Subject: [PATCH] [3.9] bpo-42224: Fix test_format when locale does not expect number grouping (GH-23067) (cherry picked from commit 301822859b3fc34801a06f1090d62f9f2ee5b092) Co-authored-by: Lysandros Nikolaou --- Lib/test/test_format.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py index d2744cdfdca60e..9653e46ecc52d8 100644 --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -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: