Lichen

tests/swap.py

1037:2ef21d25c6e5
5 months ago Paul Boddie Merged changes from the default branch. trailing-data
     1 # Test attribute accesses with sequence assignments.     2      3 class C:     4     a = 1; b = 2; c = 3     5      6 # This cannot assign directly...     7      8 print C.a, C.b, C.c                     # 1 2 3     9 C.a, C.b, C.c = C.c, C.b, C.a    10 print C.a, C.b, C.c                     # 3 2 1    11     12 # This cannot assign directly...    13     14 D = C    15 C.a, C.b, C.c = D.c, D.b, D.a    16 print C.a, C.b, C.c                     # 1 2 3    17     18 # Test name accesses with sequence assignments.    19     20 a = 1; b = 2; c = 3    21     22 # This cannot assign directly...    23     24 print a, b, c                           # 1 2 3    25 a, b, c = c, b, a    26 print a, b, c                           # 3 2 1    27     28 # This can assign directly...    29     30 d, e, f = c, b, a    31 print d, e, f                           # 1 2 3    32     33 # This can assign directly...    34     35 a, (b, c) = d, (e, f)    36 print a, b, c                           # 1 2 3    37     38 # This cannot assign directly...    39     40 (c, b), a = (a, b), c    41 print a, b, c                           # 3 2 1