(error_type: type, *, match: str | None = None)
| 219 | |
| 220 | @contextlib.contextmanager |
| 221 | def _assert_error_trace(error_type: type, *, match: str | None = None): |
| 222 | file_name = os.path.abspath(__file__) |
| 223 | with pytest.raises(error_type, match=match) as e: |
| 224 | yield e |
| 225 | assert re.match( |
| 226 | rf"Occurred here:\n Line: .* # cause\n File: {re.escape(file_name)}:\d+$", |
| 227 | e.value._pathway_trace_note, |
| 228 | ) |
| 229 | |
| 230 | |
| 231 | def test_traceback_expression(): |
no outgoing calls
no test coverage detected