Skip to content

Commit edfbc67

Browse files
committed
Update dict copy tests
1 parent d3672cf commit edfbc67

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

mypyc/test-data/run-dicts.test

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,6 @@ assert get_content(od) == ([3, 1], [4, 2], [(3, 4), (1, 2)])
9292
assert get_content_set({1: 2}) == ({1}, {2}, {(1, 2)})
9393
assert get_content_set(od) == ({1, 3}, {2, 4}, {(1, 2), (3, 4)})
9494

95-
from typing import Dict
96-
from collections import defaultdict
97-
d = {}
98-
assert d.copy() == d
99-
d = {'a': 1, 'b': 2}
100-
assert d.copy() == d
101-
assert d.copy() is not d
102-
dd: Dict[str, int] = defaultdict(int)
103-
dd['a'] = 1
104-
assert dd.copy() == dd
105-
assert isinstance(dd.copy(), defaultdict)
10695
[typing fixtures/typing-full.pyi]
10796

10897
[case testDictIterationMethodsRun]
@@ -204,3 +193,18 @@ else:
204193
2
205194
4
206195
2
196+
197+
[case testDictMethods]
198+
from collections import defaultdict
199+
from typing import Dict
200+
201+
def test_dict_copy() -> None:
202+
d: Dict[str, int] = {}
203+
assert d.copy() == d # type: ignore
204+
d = {'a': 1, 'b': 2}
205+
assert d.copy() == d # type: ignore
206+
assert d.copy() is not d # type: ignore
207+
dd: Dict[str, int] = defaultdict(int)
208+
dd['a'] = 1
209+
assert dd.copy() == dd # type: ignore
210+
assert isinstance(dd.copy(), defaultdict) # type: ignore

0 commit comments

Comments
 (0)