(self)
| 40 | |
| 41 | class TestWarningsRecorderChecker: |
| 42 | def test_recording(self) -> None: |
| 43 | rec = WarningsRecorder(_ispytest=True) |
| 44 | with rec: |
| 45 | assert not rec.list |
| 46 | warnings.warn_explicit("hello", UserWarning, "xyz", 13) |
| 47 | assert len(rec.list) == 1 |
| 48 | warnings.warn(DeprecationWarning("hello")) |
| 49 | assert len(rec.list) == 2 |
| 50 | warn = rec.pop() |
| 51 | assert str(warn.message) == "hello" |
| 52 | values = rec.list |
| 53 | rec.clear() |
| 54 | assert len(rec.list) == 0 |
| 55 | assert values is rec.list |
| 56 | pytest.raises(AssertionError, rec.pop) |
| 57 | |
| 58 | def test_warn_stacklevel(self) -> None: |
| 59 | """#4243""" |
nothing calls this directly
no test coverage detected