| 352 | |
| 353 | |
| 354 | def test_excinfo_repr_str() -> None: |
| 355 | with pytest.raises(ValueError) as excinfo1: |
| 356 | h() |
| 357 | assert repr(excinfo1) == "<ExceptionInfo ValueError() tblen=4>" |
| 358 | assert str(excinfo1) == "<ExceptionInfo ValueError() tblen=4>" |
| 359 | |
| 360 | class CustomException(Exception): |
| 361 | def __repr__(self): |
| 362 | return "custom_repr" |
| 363 | |
| 364 | def raises() -> None: |
| 365 | raise CustomException() |
| 366 | |
| 367 | with pytest.raises(CustomException) as excinfo2: |
| 368 | raises() |
| 369 | assert repr(excinfo2) == "<ExceptionInfo custom_repr tblen=2>" |
| 370 | assert str(excinfo2) == "<ExceptionInfo custom_repr tblen=2>" |
| 371 | |
| 372 | |
| 373 | def test_excinfo_for_later() -> None: |