MCPcopy
hub / github.com/pytest-dev/pytest / test_delitem

Function test_delitem

testing/test_monkeypatch.py:181–196  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

179
180
181def test_delitem() -> None:
182 d: dict[str, object] = {"x": 1}
183 monkeypatch = MonkeyPatch()
184 monkeypatch.delitem(d, "x")
185 assert "x" not in d
186 monkeypatch.delitem(d, "y", raising=False)
187 with pytest.raises(KeyError):
188 monkeypatch.delitem(d, "y")
189 assert not d
190 monkeypatch.setitem(d, "y", 1700)
191 assert d["y"] == 1700
192 d["hello"] = "world"
193 monkeypatch.setitem(d, "x", 1500)
194 assert d["x"] == 1500
195 monkeypatch.undo()
196 assert d == {"hello": "world", "x": 1}
197
198
199def test_setenv() -> None:

Callers

nothing calls this directly

Calls 4

delitemMethod · 0.95
setitemMethod · 0.95
undoMethod · 0.95
MonkeyPatchClass · 0.90

Tested by

no test coverage detected