()
| 91 | |
| 92 | |
| 93 | def test_delattr() -> None: |
| 94 | class A: |
| 95 | x = 1 |
| 96 | |
| 97 | monkeypatch = MonkeyPatch() |
| 98 | monkeypatch.delattr(A, "x") |
| 99 | assert not hasattr(A, "x") |
| 100 | monkeypatch.undo() |
| 101 | assert A.x == 1 |
| 102 | |
| 103 | monkeypatch = MonkeyPatch() |
| 104 | monkeypatch.delattr(A, "x") |
| 105 | pytest.raises(AttributeError, monkeypatch.delattr, A, "y") |
| 106 | monkeypatch.delattr(A, "y", raising=False) |
| 107 | monkeypatch.setattr(A, "x", 5, raising=False) |
| 108 | assert A.x == 5 |
| 109 | monkeypatch.undo() |
| 110 | assert A.x == 1 |
| 111 | |
| 112 | |
| 113 | def test_setitem() -> None: |
nothing calls this directly
no test coverage detected