summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_long.py2
-rw-r--r--Lib/test/test_types.py15
2 files changed, 14 insertions, 3 deletions
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py
index 7e159aa..256a1ce 100644
--- a/Lib/test/test_long.py
+++ b/Lib/test/test_long.py
@@ -761,7 +761,7 @@ class LongTest(unittest.TestCase):
# ensure that float type specifiers work; format converts
# the int to a float
- for format_spec in 'eEfFgGn%':
+ for format_spec in 'eEfFgG%':
for value in [0, 1, -1, 100, -100, 1234567890, -1234567890]:
self.assertEqual(format(value, format_spec),
format(float(value), format_spec))
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
index 1c7a8cd..2fc0004 100644
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -313,7 +313,7 @@ class TypesTests(unittest.TestCase):
# ensure that float type specifiers work; format converts
# the int to a float
- for format_spec in 'eEfFgGn%':
+ for format_spec in 'eEfFgG%':
for value in [0, 1, -1, 100, -100, 1234567890, -1234567890]:
self.assertEqual(value.__format__(format_spec),
float(value).__format__(format_spec))
@@ -403,7 +403,7 @@ class TypesTests(unittest.TestCase):
# ensure that float type specifiers work; format converts
# the long to a float
- for format_spec in 'eEfFgGn%':
+ for format_spec in 'eEfFgG%':
for value in [0, 1, -1, 100, -100, 1234567890, -1234567890]:
self.assertEqual(value.__format__(format_spec),
float(value).__format__(format_spec))
@@ -417,6 +417,17 @@ class TypesTests(unittest.TestCase):
self.assertEqual(locale.format('%g', x, grouping=True), format(x, 'n'))
self.assertEqual(locale.format('%.10g', x, grouping=True), format(x, '.10n'))
+ @run_with_locale('LC_NUMERIC', 'en_US.UTF8')
+ def test_int__format__locale(self):
+ # test locale support for __format__ code 'n' for integers
+
+ x = 123456789012345678901234567890
+ for i in range(0, 30):
+ self.assertEqual(locale.format('%d', x, grouping=True), format(x, 'n'))
+
+ # move to the next integer to test
+ x = x // 10
+
def test_float__format__(self):
# these should be rewritten to use both format(x, spec) and
# x.__format__(spec)