diff --git a/src/_pytest/monkeypatch.py b/src/_pytest/monkeypatch.py index 1df864b05..6d63da443 100644 --- a/src/_pytest/monkeypatch.py +++ b/src/_pytest/monkeypatch.py @@ -295,7 +295,11 @@ class MonkeyPatch: self._setitem.append((dic, name, dic.get(name, notset))) dic[name] = value - def delitem(self, dic: Mapping[K, V], name: K, raising: bool = True, + def delitem( + self, + dic: Mapping[K, V], + name: K, + raising: bool = True, ) -> None: """Delete ``name`` from dict. diff --git a/testing/typing_checks.py b/testing/typing_checks.py index 1f69430ee..765837bb4 100644 --- a/testing/typing_checks.py +++ b/testing/typing_checks.py @@ -41,6 +41,7 @@ def check_monkeypatch_typeddict(monkeypatch: MonkeyPatch) -> None: class Foo(TypedDict): x: int y: float + a: Foo = {"x": 1, "y": 3.14} monkeypatch.setitem("x", 2) monkeypatch.delitem("y")