Skip to content

Commit 66cf58e

Browse files
authored
Add tests for MutableMapping.update() (#14104)
1 parent cb37f1d commit 66cf58e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

stdlib/@tests/test_cases/typing/check_MutableMapping.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,32 @@
44
from typing_extensions import assert_type
55

66

7+
def check_update_method__int_key() -> None:
8+
d: dict[int, int] = {}
9+
d.update({1: 2})
10+
d.update([(1, 2)])
11+
d.update(a=3) # type: ignore
12+
d.update({1: 2}, a=3) # type: ignore
13+
d.update([(1, 2)], a=3) # type: ignore
14+
d.update({"": 3}) # type: ignore
15+
d.update({1: ""}) # type: ignore
16+
d.update([("", 3)]) # type: ignore
17+
d.update([(3, "")]) # type: ignore
18+
19+
20+
def check_update_method__str_key() -> None:
21+
d: dict[str, int] = {}
22+
d.update({"": 2})
23+
d.update([("", 2)])
24+
d.update(a=3)
25+
d.update({"": 2}, a=3)
26+
d.update([("", 2)], a=3)
27+
d.update({1: 3}) # type: ignore
28+
d.update({"": ""}) # type: ignore
29+
d.update([(1, 3)]) # type: ignore
30+
d.update([("", "")]) # type: ignore
31+
32+
733
def check_setdefault_method() -> None:
834
d: dict[int, str] = {}
935
d2: dict[int, str | None] = {}

0 commit comments

Comments
 (0)