diff options
author | Brett Cannon <brett@python.org> | 2012-02-24 00:34:55 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2012-02-24 00:34:55 (GMT) |
commit | 6858cabb265ed752aeb27cacbacd58817daaacaa (patch) | |
tree | 3c21de785e9485916a078b048a6b5414cf9b98a8 /Lib | |
parent | dfc32706a0422c81a470a38c8197af3be187416d (diff) | |
parent | 41a863cb81608c779d60b49e7be8a115816734fc (diff) | |
download | cpython-6858cabb265ed752aeb27cacbacd58817daaacaa.zip cpython-6858cabb265ed752aeb27cacbacd58817daaacaa.tar.gz cpython-6858cabb265ed752aeb27cacbacd58817daaacaa.tar.bz2 |
merge
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_format.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py index 7345b30..70e748f 100644 --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -1,4 +1,5 @@ from test.support import verbose, TestFailed +import locale import sys import test.support as support import unittest @@ -282,6 +283,20 @@ class FormatTest(unittest.TestCase): self.assertEqual(format(1+2j, "\u2007^8"), "\u2007(1+2j)\u2007") self.assertEqual(format(0j, "\u2007^4"), "\u20070j\u2007") + def test_locale(self): + try: + oldloc = locale.setlocale(locale.LC_ALL, '') + except locale.Error as err: + self.skipTest("Cannot set locale: {}".format(err)) + try: + sep = locale.localeconv()['thousands_sep'] + text = format(123456789, "n") + self.assertIn(sep, text) + self.assertEqual(text.replace(sep, ''), '123456789') + finally: + locale.setlocale(locale.LC_ALL, oldloc) + + def test_main(): support.run_unittest(FormatTest) |