Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 38e43c2

Browse files
committed
Adapt to new exception message.
Simplify formatting (use "%r" % x instead of "%s" % repr(x)).
1 parent 3f1e65c commit 38e43c2

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Lib/test/test_format.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
def testformat(formatstr, args, output=None):
1414
if verbose:
1515
if output:
16-
print("%s %% %s =? %s ..." %\
17-
(repr(formatstr), repr(args), repr(output)), end=' ')
16+
print("%r %% %r =? %r ..." %\
17+
(formatstr, args, output), end=' ')
1818
else:
19-
print("%s %% %s works? ..." % (repr(formatstr), repr(args)), end=' ')
19+
print("%r %% %r works? ..." % (formatstr, args), end=' ')
2020
try:
2121
result = formatstr % args
2222
except OverflowError:
@@ -28,8 +28,8 @@ def testformat(formatstr, args, output=None):
2828
if output and result != output:
2929
if verbose:
3030
print('no')
31-
print("%s %% %s == %s != %s" %\
32-
(repr(formatstr), repr(args), repr(result), repr(output)))
31+
print("%r %% %r == %r != %r" %\
32+
(formatstr, args, result, output))
3333
else:
3434
if verbose:
3535
print('yes')
@@ -222,7 +222,7 @@ def __oct__(self):
222222
return self + 1
223223

224224
test_exc('%o', Foobar(), TypeError,
225-
"expected str object, int found")
225+
"expected string, int found")
226226

227227
if maxsize == 2**31-1:
228228
# crashes 2.2.1 and earlier:

0 commit comments

Comments
 (0)