Show More
@@ -6,6 +6,7 b' import pytest' | |||||
6 | from tempfile import TemporaryDirectory |
|
6 | from tempfile import TemporaryDirectory | |
7 | from IPython.testing import tools as tt |
|
7 | from IPython.testing import tools as tt | |
8 |
|
8 | |||
|
9 | ||||
9 | def _exceptiongroup_common( |
|
10 | def _exceptiongroup_common( | |
10 | outer_chain: str, |
|
11 | outer_chain: str, | |
11 | inner_chain: str, |
|
12 | inner_chain: str, | |
@@ -60,7 +61,7 b' def _exceptiongroup_common(' | |||||
60 | match_lines += [ |
|
61 | match_lines += [ | |
61 | "During handling of the above exception, another exception occurred:", |
|
62 | "During handling of the above exception, another exception occurred:", | |
62 | ] |
|
63 | ] | |
63 |
elif inner_chain == |
|
64 | elif inner_chain == "from": | |
64 | match_lines += [ |
|
65 | match_lines += [ | |
65 | "The above exception was the direct cause of the following exception:", |
|
66 | "The above exception was the direct cause of the following exception:", | |
66 | ] |
|
67 | ] | |
@@ -92,7 +93,8 b' def _exceptiongroup_common(' | |||||
92 | error_lines = error_lines[i+1:] |
|
93 | error_lines = error_lines[i + 1 :] | |
93 | break |
|
94 | break | |
94 | else: |
|
95 | else: | |
95 |
assert False, f |
|
96 | assert False, f"{expected} not found in cap.stderr" | |
|
97 | ||||
96 |
|
98 | |||
97 | @pytest.mark.skipif( |
|
99 | @pytest.mark.skipif( | |
98 |
|
|
100 | sys.version_info < (3, 11), reason="Native ExceptionGroup not implemented" | |
@@ -102,6 +104,7 b' def _exceptiongroup_common(' | |||||
102 | def test_native_exceptiongroup(outer_chain, inner_chain) -> None: |
|
104 | def test_native_exceptiongroup(outer_chain, inner_chain) -> None: | |
103 | _exceptiongroup_common(outer_chain, inner_chain, native=True) |
|
105 | _exceptiongroup_common(outer_chain, inner_chain, native=True) | |
104 |
|
106 | |||
|
107 | ||||
105 | @pytest.mark.parametrize("outer_chain", ["none", "from", "another"]) |
|
108 | @pytest.mark.parametrize("outer_chain", ["none", "from", "another"]) | |
106 | @pytest.mark.parametrize("inner_chain", ["none", "from", "another"]) |
|
109 | @pytest.mark.parametrize("inner_chain", ["none", "from", "another"]) | |
107 | def test_native_exceptiongroup(outer_chain, inner_chain) -> None: |
|
110 | def test_native_exceptiongroup(outer_chain, inner_chain) -> None: |
General Comments 0
You need to be logged in to leave comments.
Login now