summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_extcall.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-01-10 16:19:56 (GMT)
committerGuido van Rossum <guido@python.org>2007-01-10 16:19:56 (GMT)
commitb940e113bf90ff71b0ef57414ea2beea9d2a4bc0 (patch)
tree0b9ea19eba1e665dac95126c3140ac2bc36326ad /Lib/test/test_extcall.py
parent893523e80a2003d4a630aafb84ba016e0070cbbd (diff)
downloadcpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.zip
cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.tar.gz
cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.tar.bz2
SF patch 1631942 by Collin Winter:
(a) "except E, V" -> "except E as V" (b) V is now limited to a simple name (local variable) (c) V is now deleted at the end of the except block
Diffstat (limited to 'Lib/test/test_extcall.py')
-rw-r--r--Lib/test/test_extcall.py40
1 files changed, 20 insertions, 20 deletions
diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py
index 284dbb2..11cf43a 100644
--- a/Lib/test/test_extcall.py
+++ b/Lib/test/test_extcall.py
@@ -35,21 +35,21 @@ else:
try:
g()
-except TypeError, err:
+except TypeError as err:
print "TypeError:", err
else:
print "should raise TypeError: not enough arguments; expected 1, got 0"
try:
g(*())
-except TypeError, err:
+except TypeError as err:
print "TypeError:", err
else:
print "should raise TypeError: not enough arguments; expected 1, got 0"
try:
g(*(), **{})
-except TypeError, err:
+except TypeError as err:
print "TypeError:", err
else:
print "should raise TypeError: not enough arguments; expected 1, got 0"
@@ -61,7 +61,7 @@ g(1, 2, 3, *(4, 5))
class Nothing: pass
try:
g(*Nothing())
-except TypeError, attr:
+except TypeError as attr:
pass
else:
print "should raise TypeError"
@@ -71,7 +71,7 @@ class Nothing:
return 5
try:
g(*Nothing())
-except TypeError, attr:
+except TypeError as attr:
pass
else:
print "should raise TypeError"
@@ -93,7 +93,7 @@ class Nothing:
return self
try:
g(*Nothing())
-except TypeError, attr:
+except TypeError as attr:
pass
else:
print "should raise TypeError"
@@ -132,77 +132,77 @@ del kw['x']
try:
g(1, 2, 3, **{'x':4, 'y':5})
-except TypeError, err:
+except TypeError as err:
print err
else:
print "should raise TypeError: keyword parameter redefined"
try:
g(1, 2, 3, a=4, b=5, *(6, 7), **{'a':8, 'b':9})
-except TypeError, err:
+except TypeError as err:
print err
else:
print "should raise TypeError: keyword parameter redefined"
try:
f(**{1:2})
-except TypeError, err:
+except TypeError as err:
print err
else:
print "should raise TypeError: keywords must be strings"
try:
h(**{'e': 2})
-except TypeError, err:
+except TypeError as err:
print err
else:
print "should raise TypeError: unexpected keyword argument: e"
try:
h(*h)
-except TypeError, err:
+except TypeError as err:
print err
else:
print "should raise TypeError: * argument must be a tuple"
try:
dir(*h)
-except TypeError, err:
+except TypeError as err:
print err
else:
print "should raise TypeError: * argument must be a tuple"
try:
None(*h)
-except TypeError, err:
+except TypeError as err:
print err
else:
print "should raise TypeError: * argument must be a tuple"
try:
h(**h)
-except TypeError, err:
+except TypeError as err:
print err
else:
print "should raise TypeError: ** argument must be a dictionary"
try:
dir(**h)
-except TypeError, err:
+except TypeError as err:
print err
else:
print "should raise TypeError: ** argument must be a dictionary"
try:
None(**h)
-except TypeError, err:
+except TypeError as err:
print err
else:
print "should raise TypeError: ** argument must be a dictionary"
try:
dir(b=1,**{'b':1})
-except TypeError, err:
+except TypeError as err:
print err
else:
print "should raise TypeError: dir() got multiple values for keyword argument 'b'"
@@ -226,13 +226,13 @@ print Foo.method(*(x, 1, 2))
print Foo.method(x, *(1, 2))
try:
print Foo.method(*(1, 2, 3))
-except TypeError, err:
+except TypeError as err:
pass
else:
print 'expected a TypeError for unbound method call'
try:
print Foo.method(1, *(2, 3))
-except TypeError, err:
+except TypeError as err:
pass
else:
print 'expected a TypeError for unbound method call'
@@ -276,4 +276,4 @@ for name in ['za', 'zade', 'zabk', 'zabdv', 'zabdevk']:
for k in kwargs: kwdict[k] = k + k
print func.func_name, args, sortdict(kwdict), '->',
try: func(*args, **kwdict)
- except TypeError, err: print err
+ except TypeError as err: print err