Commit 6759b3bb authored by Robert Bradshaw's avatar Robert Bradshaw

Failing tests for automatic exception values.

parent 7cac3e06
......@@ -19,3 +19,23 @@ def test_bool(bool a):
False
"""
return a
cdef bool may_raise_exception(bool value, exception) except *:
if exception:
raise exception
else:
return value
def test_may_raise_exception(bool value, exception=None):
"""
>>> test_may_raise_exception(False)
False
>>> test_may_raise_exception(True)
True
>>> test_may_raise_exception(True, RuntimeError)
Traceback (most recent call last):
...
RuntimeError
"""
return may_raise_exception(value, exception)
......@@ -42,3 +42,18 @@ def test_except_big_result(bint fire):
RuntimeError
"""
except_big_result(fire)
cdef unsigned short except_promotion_compare(bint fire) except *:
if fire:
raise RuntimeError
def test_except_promotion_compare(bint fire):
"""
>>> test_except_promotion_compare(False)
>>> test_except_promotion_compare(True)
Traceback (most recent call last):
...
RuntimeError
"""
except_promotion_compare(fire)
\ No newline at end of file
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