(self)
| 84 | |
| 85 | class TestWarningsRecorderChecker: |
| 86 | def test_recording(self) -> None: |
| 87 | rec = WarningsRecorder(_ispytest=True) |
| 88 | with rec: |
| 89 | assert not rec.list |
| 90 | warnings.warn_explicit(class="st">"hello", UserWarning, class="st">"xyz", 13) |
| 91 | assert len(rec.list) == 1 |
| 92 | warnings.warn(DeprecationWarning(class="st">"hello")) |
| 93 | assert len(rec.list) == 2 |
| 94 | warn = rec.pop() |
| 95 | assert str(warn.message) == class="st">"hello" |
| 96 | values = rec.list |
| 97 | rec.clear() |
| 98 | assert len(rec.list) == 0 |
| 99 | assert values is rec.list |
| 100 | with pytest.raises(AssertionError): |
| 101 | rec.pop() |
| 102 | |
| 103 | def test_warn_stacklevel(self) -> None: |
| 104 | class="st">""class="st">"class="cm">#4243"class="st">"" |
nothing calls this directly
no test coverage detected