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