Skip to content

Commit 1c8e04d

Browse files
authored
Update run-lists.test
added tests for list.copy()
1 parent 9cf5232 commit 1c8e04d

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

mypyc/test-data/run-lists.test

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,33 @@ print(2, a)
5151
1 [-1, 5]
5252
2 [340282366920938463463374607431768211461, -170141183460469231731687303715884105736]
5353

54+
[case testListCopy]
55+
def test_list_copy() -> None:
56+
l1 = [1, 2, 3, -4, 5]
57+
l2 = l1.copy()
58+
assert l1.copy() == l1
59+
assert l1.copy() == l2
60+
assert l1 == l2
61+
assert l1.copy() == l2.copy()
62+
l1 = l2.copy()
63+
assert l1 == l2
64+
assert l1.copy() == l2
65+
assert l1 == [1, 2, 3, -4, 5]
66+
l2 = [1, 2, -3]
67+
l1 = []
68+
assert l1.copy() == []
69+
assert l2.copy() != l1
70+
assert l2 == l2.copy()
71+
l1 = l2
72+
assert l1.copy().copy() == l2.copy().copy().copy()
73+
assert l1.copy() == l2.copy()
74+
l1 == [1, 2, -3].copy()
75+
assert l1 == l2
76+
l2 = [1, 2, 3].copy()
77+
assert l2 != l1
78+
l1 = [1, 2, 3]
79+
assert l1.copy() == l2.copy()
80+
5481
[case testSieve]
5582
from typing import List
5683

0 commit comments

Comments
 (0)