()
| 1331 | |
| 1332 | |
| 1333 | def test_tuples() -> None: |
| 1334 | # raises has historically supported one of several exceptions being raised |
| 1335 | with pytest.raises((ValueError, IndexError)): |
| 1336 | raise ValueError |
| 1337 | # so now RaisesExc also does |
| 1338 | with RaisesExc((ValueError, IndexError)): |
| 1339 | raise IndexError |
| 1340 | # but RaisesGroup currently doesn't. There's an argument it shouldn't because |
| 1341 | # it can be confusing - RaisesGroup((ValueError, TypeError)) looks a lot like |
| 1342 | # RaisesGroup(ValueError, TypeError), and the former might be interpreted as the latter. |
| 1343 | with pytest.raises( |
| 1344 | TypeError, |
| 1345 | match=wrap_escape( |
| 1346 | "Expected a BaseException type, RaisesExc, or RaisesGroup, but got 'tuple'.\n" |
| 1347 | "RaisesGroup does not support tuples of exception types when expecting one of " |
| 1348 | "several possible exception types like RaisesExc.\n" |
| 1349 | "If you meant to expect a group with multiple exceptions, list them as separate arguments." |
| 1350 | ), |
| 1351 | ): |
| 1352 | RaisesGroup((ValueError, IndexError)) # type: ignore[call-overload] |
| 1353 | |
| 1354 | |
| 1355 | def test_expected_matching_only_on_matching() -> None: |
nothing calls this directly
no test coverage detected