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.
........
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 @@
# 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 @@
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 @@
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")