Kaydet (Commit) ceccc3c0 authored tarafından Jeremy Hylton's avatar Jeremy Hylton

Test cases for examples of ext call error handling.

Fix to SF bug #414743 based on Michael Hudson's patch #414750.
üst 512a2377
...@@ -25,7 +25,12 @@ g() got multiple values for keyword argument 'b' ...@@ -25,7 +25,12 @@ g() got multiple values for keyword argument 'b'
f() keywords must be strings f() keywords must be strings
h() got an unexpected keyword argument 'e' h() got an unexpected keyword argument 'e'
h() argument after * must be a sequence h() argument after * must be a sequence
dir() argument after * must be a sequence
None object argument after * must be a sequence
h() argument after ** must be a dictionary h() argument after ** must be a dictionary
dir() argument after ** must be a dictionary
None object argument after ** must be a dictionary
dir() got multiple values for keyword argument 'b'
3 512 1 3 512 1
3 3
3 3
......
...@@ -137,6 +137,20 @@ except TypeError, err: ...@@ -137,6 +137,20 @@ except TypeError, err:
else: else:
print "should raise TypeError: * argument must be a tuple" print "should raise TypeError: * argument must be a tuple"
try:
dir(*h)
except TypeError, err:
print err
else:
print "should raise TypeError: * argument must be a tuple"
try:
None(*h)
except TypeError, err:
print err
else:
print "should raise TypeError: * argument must be a tuple"
try: try:
h(**h) h(**h)
except TypeError, err: except TypeError, err:
...@@ -144,6 +158,27 @@ except TypeError, err: ...@@ -144,6 +158,27 @@ except TypeError, err:
else: else:
print "should raise TypeError: ** argument must be a dictionary" print "should raise TypeError: ** argument must be a dictionary"
try:
dir(**h)
except TypeError, err:
print err
else:
print "should raise TypeError: ** argument must be a dictionary"
try:
None(**h)
except TypeError, err:
print err
else:
print "should raise TypeError: ** argument must be a dictionary"
try:
dir(b=1,**{'b':1})
except TypeError, err:
print err
else:
print "should raise TypeError: dir() got multiple values for keyword argument 'b'"
def f2(*a, **b): def f2(*a, **b):
return a, b return a, b
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment