diff options
author | Eric Smith <eric@trueblade.com> | 2008-07-17 18:30:48 (GMT) |
---|---|---|
committer | Eric Smith <eric@trueblade.com> | 2008-07-17 18:30:48 (GMT) |
commit | a4fac36eb3ee70529482d43d2a484d5ff5d18398 (patch) | |
tree | f28ae6605017ff42d83cdf78978391b4c7237079 /Lib | |
parent | ddc5669fd90135ba345a9f1a98a11c67a97f833e (diff) | |
download | cpython-a4fac36eb3ee70529482d43d2a484d5ff5d18398.zip cpython-a4fac36eb3ee70529482d43d2a484d5ff5d18398.tar.gz cpython-a4fac36eb3ee70529482d43d2a484d5ff5d18398.tar.bz2 |
Merged revisions 65069 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r65069 | eric.smith | 2008-07-17 13:48:39 -0400 (Thu, 17 Jul 2008) | 1 line
Issue 3382: Make '%F' and float.__format__('F') convert results to upper case.
........
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_format.py | 11 | ||||
-rw-r--r-- | Lib/test/test_types.py | 12 |
2 files changed, 21 insertions, 2 deletions
diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py index 6d32e86..30b07d8 100644 --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -79,6 +79,17 @@ class FormatTest(unittest.TestCase): testformat("%#.*f", (110, -1.e+100/3.)) testformat("%#.*F", (110, -1.e+100/3.)) overflowrequired = 0 + # check for %f and %F + testformat("%f", (1.0,), "1.000000") + testformat("%F", (1.0,), "1.000000") + testformat("%f", (1e100,), "1e+100") + testformat("%F", (1e100,), "1E+100") + testformat("%f", (1e100,), "1e+100") + testformat("%F", (1e100,), "1E+100") + testformat("%f", (float('nan'),), "nan") + testformat("%F", (float('nan'),), "NAN") + testformat("%f", (float('inf'),), "inf") + testformat("%F", (float('inf'),), "INF") # Formatting of integers. Overflow is not ok overflowok = 0 testformat("%x", 10, "a") diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py index 1b8e605..4db1184 100644 --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -514,9 +514,17 @@ class TypesTests(unittest.TestCase): test( 1.0, '+f', '+1.000000') test(-1.0, '+f', '-1.000000') test(1.1234e90, 'f', '1.1234e+90') - test(1.1234e90, 'F', '1.1234e+90') + test(1.1234e90, 'F', '1.1234E+90') test(1.1234e200, 'f', '1.1234e+200') - test(1.1234e200, 'F', '1.1234e+200') + test(1.1234e200, 'F', '1.1234E+200') + test(1e100, 'x<20f', '1e+100xxxxxxxxxxxxxx') + test(1e100, 'x<20F', '1E+100xxxxxxxxxxxxxx') + test(float('nan'), 'f', 'nan') + test(float('nan'), 'F', 'NAN') + test(float('inf'), 'f', 'inf') + test(float('inf'), 'F', 'INF') + test(float('-inf'), 'f', '-inf') + test(float('-inf'), 'F', '-INF') test( 1.0, 'e', '1.000000e+00') test(-1.0, 'e', '-1.000000e+00') |