[Python-3000-checkins] r55848 - python/branches/py3k-struni/Lib/test/test_format.py

walter.doerwald python-3000-checkins at python.org
Sat Jun 9 18:13:30 CEST 2007


Author: walter.doerwald
Date: Sat Jun  9 18:13:23 2007
New Revision: 55848

Modified:
   python/branches/py3k-struni/Lib/test/test_format.py
Log:
Adapt to new exception message.

Simplify formatting (use "%r" % x instead of "%s" % repr(x)).


Modified: python/branches/py3k-struni/Lib/test/test_format.py
==============================================================================
--- python/branches/py3k-struni/Lib/test/test_format.py	(original)
+++ python/branches/py3k-struni/Lib/test/test_format.py	Sat Jun  9 18:13:23 2007
@@ -13,10 +13,10 @@
 def testformat(formatstr, args, output=None):
     if verbose:
         if output:
-            print("%s %% %s =? %s ..." %\
-                (repr(formatstr), repr(args), repr(output)), end=' ')
+            print("%r %% %r =? %r ..." %\
+                (formatstr, args, output), end=' ')
         else:
-            print("%s %% %s works? ..." % (repr(formatstr), repr(args)), end=' ')
+            print("%r %% %r works? ..." % (formatstr, args), end=' ')
     try:
         result = formatstr % args
     except OverflowError:
@@ -28,8 +28,8 @@
         if output and result != output:
             if verbose:
                 print('no')
-            print("%s %% %s == %s != %s" %\
-                (repr(formatstr), repr(args), repr(result), repr(output)))
+            print("%r %% %r == %r != %r" %\
+                (formatstr, args, result, output))
         else:
             if verbose:
                 print('yes')
@@ -222,7 +222,7 @@
         return self + 1
 
 test_exc('%o', Foobar(), TypeError,
-         "expected str object, int found")
+         "expected string, int found")
 
 if maxsize == 2**31-1:
     # crashes 2.2.1 and earlier:


More information about the Python-3000-checkins mailing list