mirror of https://github.com/python/cpython.git
Adapt to new exception message.
Simplify formatting (use "%r" % x instead of "%s" % repr(x)).
This commit is contained in:
parent
3f1e65cfde
commit
38e43c25ee
|
@ -13,10 +13,10 @@
|
||||||
def testformat(formatstr, args, output=None):
|
def testformat(formatstr, args, output=None):
|
||||||
if verbose:
|
if verbose:
|
||||||
if output:
|
if output:
|
||||||
print("%s %% %s =? %s ..." %\
|
print("%r %% %r =? %r ..." %\
|
||||||
(repr(formatstr), repr(args), repr(output)), end=' ')
|
(formatstr, args, output), end=' ')
|
||||||
else:
|
else:
|
||||||
print("%s %% %s works? ..." % (repr(formatstr), repr(args)), end=' ')
|
print("%r %% %r works? ..." % (formatstr, args), end=' ')
|
||||||
try:
|
try:
|
||||||
result = formatstr % args
|
result = formatstr % args
|
||||||
except OverflowError:
|
except OverflowError:
|
||||||
|
@ -28,8 +28,8 @@ def testformat(formatstr, args, output=None):
|
||||||
if output and result != output:
|
if output and result != output:
|
||||||
if verbose:
|
if verbose:
|
||||||
print('no')
|
print('no')
|
||||||
print("%s %% %s == %s != %s" %\
|
print("%r %% %r == %r != %r" %\
|
||||||
(repr(formatstr), repr(args), repr(result), repr(output)))
|
(formatstr, args, result, output))
|
||||||
else:
|
else:
|
||||||
if verbose:
|
if verbose:
|
||||||
print('yes')
|
print('yes')
|
||||||
|
@ -222,7 +222,7 @@ def __oct__(self):
|
||||||
return self + 1
|
return self + 1
|
||||||
|
|
||||||
test_exc('%o', Foobar(), TypeError,
|
test_exc('%o', Foobar(), TypeError,
|
||||||
"expected str object, int found")
|
"expected string, int found")
|
||||||
|
|
||||||
if maxsize == 2**31-1:
|
if maxsize == 2**31-1:
|
||||||
# crashes 2.2.1 and earlier:
|
# crashes 2.2.1 and earlier:
|
||||||
|
|
Loading…
Reference in New Issue