summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2012-02-24 00:44:47 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2012-02-24 00:44:47 (GMT)
commit90f50d4df9e21093f006427fd7ed11a0d704f792 (patch)
tree0651d6bff923a47322b798b554cbac68c34c845d /Lib
parent6858cabb265ed752aeb27cacbacd58817daaacaa (diff)
downloadcpython-90f50d4df9e21093f006427fd7ed11a0d704f792.zip
cpython-90f50d4df9e21093f006427fd7ed11a0d704f792.tar.gz
cpython-90f50d4df9e21093f006427fd7ed11a0d704f792.tar.bz2
Issue #13706: Fix format(float, "n") for locale with non-ASCII decimal point (e.g. ps_aF)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_format.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py
index 70e748f..dc324af 100644
--- a/Lib/test/test_format.py
+++ b/Lib/test/test_format.py
@@ -289,10 +289,18 @@ class FormatTest(unittest.TestCase):
except locale.Error as err:
self.skipTest("Cannot set locale: {}".format(err))
try:
- sep = locale.localeconv()['thousands_sep']
+ localeconv = locale.localeconv()
+ sep = localeconv['thousands_sep']
+ point = localeconv['decimal_point']
+
text = format(123456789, "n")
self.assertIn(sep, text)
self.assertEqual(text.replace(sep, ''), '123456789')
+
+ text = format(1234.5, "n")
+ self.assertIn(sep, text)
+ self.assertIn(point, text)
+ self.assertEqual(text.replace(sep, ''), '1234' + point + '5')
finally:
locale.setlocale(locale.LC_ALL, oldloc)