diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2010-02-23 13:20:58 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2010-02-23 13:20:58 (GMT) |
commit | b7be5703fbf2b847d566952441aacd04ee52e370 (patch) | |
tree | c085c4d462b87755de4e130908912b612e59bb46 | |
parent | 8e615ae3bb6589993316fe960cdf6d710ad5aa66 (diff) | |
download | cpython-b7be5703fbf2b847d566952441aacd04ee52e370.zip cpython-b7be5703fbf2b847d566952441aacd04ee52e370.tar.gz cpython-b7be5703fbf2b847d566952441aacd04ee52e370.tar.bz2 |
Merged revisions 78372-78373 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78372 | mark.dickinson | 2010-02-23 12:53:52 +0000 (Tue, 23 Feb 2010) | 1 line
Make global variable overflowok into a keyword argument; this fixes a failure when running ./python -m test.regrtest -R 3:2: test_format
........
r78373 | mark.dickinson | 2010-02-23 13:06:50 +0000 (Tue, 23 Feb 2010) | 1 line
Fix spacing nit. Thanks Eric Smith for the public humiliation.
........
-rw-r--r-- | Lib/test/test_format.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py index 88eb61a..7fa950d 100644 --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -10,9 +10,7 @@ maxsize = support.MAX_Py_ssize_t # they crash python) # test on unicode strings as well -overflowok = 1 - -def testformat(formatstr, args, output=None, limit=None): +def testformat(formatstr, args, output=None, limit=None, overflowok=False): if verbose: if output: print("%r %% %r =? %r ..." %\ @@ -50,13 +48,19 @@ def testformat(formatstr, args, output=None, limit=None): class FormatTest(unittest.TestCase): def test_format(self): - global overflowok - testformat("%.1d", (1,), "1") - testformat("%.*d", (sys.maxsize,1)) # expect overflow - testformat("%.100d", (1,), '0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001') - testformat("%#.117x", (1,), '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001') - testformat("%#.118x", (1,), '0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001') + testformat("%.*d", (sys.maxsize,1), overflowok=True) # expect overflow + testformat("%.100d", (1,), '00000000000000000000000000000000000000' + '000000000000000000000000000000000000000000000000000000' + '00000001', overflowok=True) + testformat("%#.117x", (1,), '0x00000000000000000000000000000000000' + '000000000000000000000000000000000000000000000000000000' + '0000000000000000000000000001', + overflowok=True) + testformat("%#.118x", (1,), '0x00000000000000000000000000000000000' + '000000000000000000000000000000000000000000000000000000' + '00000000000000000000000000001', + overflowok=True) testformat("%f", (1.0,), "1.000000") # these are trying to test the limits of the internal magic-number-length @@ -76,7 +80,6 @@ class FormatTest(unittest.TestCase): testformat("%#.*f", (110, -1.e+100/3.)) testformat("%#.*F", (110, -1.e+100/3.)) # Formatting of integers. Overflow is not ok - overflowok = 0 testformat("%x", 10, "a") testformat("%x", 100000000000, "174876e800") testformat("%o", 10, "12") |