()
| 115 | |
| 116 | |
| 117 | def test_delattr() -> None: |
| 118 | class A: |
| 119 | x = 1 |
| 120 | |
| 121 | monkeypatch = MonkeyPatch() |
| 122 | monkeypatch.delattr(A, "x") |
| 123 | assert not hasattr(A, "x") |
| 124 | monkeypatch.undo() |
| 125 | assert A.x == 1 |
| 126 | |
| 127 | monkeypatch = MonkeyPatch() |
| 128 | monkeypatch.delattr(A, "x") |
| 129 | with pytest.raises(AttributeError): |
| 130 | monkeypatch.delattr(A, "y") |
| 131 | monkeypatch.delattr(A, "y", raising=False) |
| 132 | monkeypatch.setattr(A, "x", 5, raising=False) |
| 133 | assert A.x == 5 |
| 134 | monkeypatch.undo() |
| 135 | assert A.x == 1 |
| 136 | |
| 137 | |
| 138 | def test_setitem() -> None: |
nothing calls this directly
no test coverage detected