Skip to content

Commit b48d77b

Browse files
committed
Add tests to check assignment works with tuple unpacking.
1 parent 416e48b commit b48d77b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/snippets/assignment.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
x = 1
2+
assert x == 1
3+
4+
x = 1, 2, 3
5+
assert x == (1, 2, 3)
6+
7+
x, y = 1, 2
8+
assert x == 1
9+
assert y == 2
10+
11+
x, y = (y, x)
12+
13+
assert x == 2
14+
assert y == 1
15+
16+
((x, y), z) = ((1, 2), 3)
17+
18+
assert (x, y, z) == (1, 2, 3)
19+
20+
q = (1, 2, 3)
21+
(x, y, z) = q
22+
assert y == q[1]
23+
24+
x = (a, b, c) = y = q
25+
26+
assert (a, b, c) == q
27+
assert x == q
28+
assert y == q

0 commit comments

Comments
 (0)