mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #13706: Fix format(float, "n") for locale with non-ASCII decimal point (e.g. ps_aF)
This commit is contained in:
parent
6858cabb26
commit
90f50d4df9
3 changed files with 31 additions and 15 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue