diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2022-03-12 12:08:33 +0100 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2022-03-12 12:08:33 +0100 |
commit | c7aed3283efdc1a0662bd8716abd9f7b1868488d (patch) | |
tree | c6753ff196ba7189a77de742756f2c59a850d323 | |
parent | 6a573cd8fc169f5e53ea7090dec7fe6512a3ff6a (diff) | |
download | cython-c7aed3283efdc1a0662bd8716abd9f7b1868488d.tar.gz |
Add a test.
-rw-r--r-- | tests/run/tryexcept.pyx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/run/tryexcept.pyx b/tests/run/tryexcept.pyx index dddf7de9b..1acc1f3ab 100644 --- a/tests/run/tryexcept.pyx +++ b/tests/run/tryexcept.pyx @@ -501,3 +501,20 @@ def complete_except_as_raise(x, a, b): else: i = 5 return i + + +def try_except_raise_new(initial, catch, throw): + """ + >>> try_except_raise_new(None, TypeError, ValueError) + >>> try_except_raise_new(TypeError, IndexError, ValueError) + Traceback (most recent call last): + TypeError + >>> try_except_raise_new(TypeError, TypeError, ValueError) + Traceback (most recent call last): + ValueError + """ + try: + if initial is not None: + raise initial + except catch: + raise throw |