diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-03-10 02:22:56 +0100 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-03-10 02:22:56 +0100 |
commit | c9705cff6860c9d77ea009ce6a6c0e9e946a0b21 (patch) | |
tree | 6e506211ec30d357dbd09ed6ef3002eea27a9bb3 | |
parent | 854bb322bf9e20f1c5afe5e8a796ebeca238fa95 (diff) |
tests/basics/fun_error: Split out skippable test.
-rw-r--r-- | tests/basics/fun_error.py | 3 | ||||
-rw-r--r-- | tests/basics/fun_error2.py | 19 |
2 files changed, 19 insertions, 3 deletions
diff --git a/tests/basics/fun_error.py b/tests/basics/fun_error.py index 305b24911..367fe0b7f 100644 --- a/tests/basics/fun_error.py +++ b/tests/basics/fun_error.py @@ -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) diff --git a/tests/basics/fun_error2.py b/tests/basics/fun_error2.py new file mode 100644 index 000000000..c4d2c0b64 --- /dev/null +++ b/tests/basics/fun_error2.py @@ -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) |