[Python-checkins] r78375 - in python/branches/py3k: Lib/test/test_format.py

mark.dickinson python-checkins at python.org
Tue Feb 23 14:20:58 CET 2010


Author: mark.dickinson
Date: Tue Feb 23 14:20:58 2010
New Revision: 78375
Log:
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 (2010年2月23日) | 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 (2010年2月23日) | 1 line
 
 Fix spacing nit. Thanks Eric Smith for the public humiliation.
........
Modified:
 python/branches/py3k/ (props changed)
 python/branches/py3k/Lib/test/test_format.py
Modified: python/branches/py3k/Lib/test/test_format.py
==============================================================================
--- python/branches/py3k/Lib/test/test_format.py	(original)
+++ python/branches/py3k/Lib/test/test_format.py	Tue Feb 23 14:20:58 2010
@@ -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")


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /