summaryrefslogtreecommitdiff
path: root/tests/basics/op_error_memoryview.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-02-14 16:50:20 +1100
committerDamien George <damien.p.george@gmail.com>2018-02-14 16:50:20 +1100
commit04c55f582866b700c5c39158ee76a1b970b71375 (patch)
tree2ba6bef5a0dc00f671d9c1959eb214890d5a80a2 /tests/basics/op_error_memoryview.py
parent6031957473a15f62ecbe59b9d27e58e9d06a4d8a (diff)
tests: Rewrite some tests so they can run without needing eval/exec.
For builds without the compiler enabled (and hence without eval/exec) it is useful to still be able to run as many tests as possible.
Diffstat (limited to 'tests/basics/op_error_memoryview.py')
-rw-r--r--tests/basics/op_error_memoryview.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/tests/basics/op_error_memoryview.py b/tests/basics/op_error_memoryview.py
index 8d4403f77..233f7f9ab 100644
--- a/tests/basics/op_error_memoryview.py
+++ b/tests/basics/op_error_memoryview.py
@@ -5,14 +5,9 @@ except:
print("SKIP")
raise SystemExit
-def test_exc(code, exc):
- try:
- exec(code)
- print("no exception")
- except exc:
- print("right exception")
- except:
- print("wrong exception")
-
# unsupported binary operators
-test_exc("m = memoryview(bytearray())\nm += bytearray()", TypeError)
+try:
+ m = memoryview(bytearray())
+ m += bytearray()
+except TypeError:
+ print('TypeError')