tests/basics/fun_error: Split out skippable test.
This commit is contained in:
parent
854bb322bf
commit
c9705cff68
@ -27,8 +27,5 @@ test_exc("[].sort(1)", TypeError)
|
||||
# function with keyword args given extra keyword args
|
||||
test_exc("[].sort(noexist=1)", TypeError)
|
||||
|
||||
# function with keyword args not given a specific keyword arg
|
||||
test_exc("enumerate()", TypeError)
|
||||
|
||||
# kw given for positional, but a different positional is missing
|
||||
test_exc("def f(x, y): pass\nf(x=1)", TypeError)
|
||||
|
19
tests/basics/fun_error2.py
Normal file
19
tests/basics/fun_error2.py
Normal file
@ -0,0 +1,19 @@
|
||||
# test errors from bad function calls
|
||||
try:
|
||||
enumerate
|
||||
except:
|
||||
print("SKIP")
|
||||
import sys
|
||||
sys.exit()
|
||||
|
||||
def test_exc(code, exc):
|
||||
try:
|
||||
exec(code)
|
||||
print("no exception")
|
||||
except exc:
|
||||
print("right exception")
|
||||
except:
|
||||
print("wrong exception")
|
||||
|
||||
# function with keyword args not given a specific keyword arg
|
||||
test_exc("enumerate()", TypeError)
|
Loading…
Reference in New Issue
Block a user