Lichen

Annotated tests/swap.py

934:2989aab1b4f7
10 months ago Paul Boddie Renamed the utf8string class to unicode, eliminating the unicode function. This means that the simple case of merely returning an object if it is already a Unicode object no longer occurs when using the unicode callable, but such behaviour might be better supported with more general customised instantiation functionality.
paul@509 1
# Test attribute accesses with sequence assignments.
paul@509 2
paul@508 3
class C:
paul@508 4
    a = 1; b = 2; c = 3
paul@508 5
paul@509 6
# This cannot assign directly...
paul@509 7
paul@508 8
print C.a, C.b, C.c                     # 1 2 3
paul@508 9
C.a, C.b, C.c = C.c, C.b, C.a
paul@508 10
print C.a, C.b, C.c                     # 3 2 1
paul@508 11
paul@509 12
# This cannot assign directly...
paul@509 13
paul@508 14
D = C
paul@508 15
C.a, C.b, C.c = D.c, D.b, D.a
paul@508 16
print C.a, C.b, C.c                     # 1 2 3
paul@509 17
paul@509 18
# Test name accesses with sequence assignments.
paul@509 19
paul@509 20
a = 1; b = 2; c = 3
paul@509 21
paul@509 22
# This cannot assign directly...
paul@509 23
paul@509 24
print a, b, c                           # 1 2 3
paul@509 25
a, b, c = c, b, a
paul@509 26
print a, b, c                           # 3 2 1
paul@509 27
paul@509 28
# This can assign directly...
paul@509 29
paul@509 30
d, e, f = c, b, a
paul@509 31
print d, e, f                           # 1 2 3
paul@509 32
paul@509 33
# This can assign directly...
paul@509 34
paul@509 35
a, (b, c) = d, (e, f)
paul@509 36
print a, b, c                           # 1 2 3
paul@509 37
paul@509 38
# This cannot assign directly...
paul@509 39
paul@509 40
(c, b), a = (a, b), c
paul@509 41
print a, b, c                           # 3 2 1