code: def test_delitem() -> None:
      d: Dict[str, object] = {"x": 1}
      monkeypatch = MonkeyPatch()
      monkeypatch.delitem(d, "x")
      assert "x" not in d
      monkeypatch.delitem(d, "y", raising=False)
      pytest.raises(KeyError, monkeypatch.delitem, d, "y")
      assert not d
      monkeypatch.setitem(d, "y", 1700)
      assert d["y"] == 1700
      d["hello"] = "world"
      monkeypatch.setitem(d, "x", 1500)
      assert d["x"] == 1500
      monkeypatch.undo()
      assert d == {"hello": "world", "x": 1}
  
imports: import os
  import re
  import sys
  import textwrap
  from pathlib import Path
  from typing import Dict
  from typing import Generator
  from typing import Type
  import pytest
  from _pytest.monkeypatch import MonkeyPatch
  from _pytest.pytester import Pytester
label_desc: Use image node_id 7 for calling a global function with example usage: test_delitem() without return types