1.1 --- a/tests/assign_sequence.py Thu Feb 09 00:37:28 2017 +0100
1.2 +++ b/tests/assign_sequence.py Thu Feb 09 15:36:02 2017 +0100
1.3 @@ -19,10 +19,18 @@
1.4 def h():
1.5 return 7, 8, 9
1.6
1.7 +def i():
1.8 + a, b, c = h()
1.9 + print a, b, c
1.10 +
1.11 +# Test assignment operations within functions.
1.12 +
1.13 f()
1.14 g(0) # [4, [1, 2, 3], 6]
1.15 g(1) # [1, 2, 3]
1.16
1.17 +# Test aliasing, assignment of list elements and direct assignment of elements.
1.18 +
1.19 l = [1, 2, 3]
1.20 x = l
1.21 a, b, c = l
1.22 @@ -32,7 +40,12 @@
1.23 print d, e, f # 1 2 3
1.24 print x # [1, 2, 3]
1.25
1.26 +# Test embedding of sequences in sequences.
1.27 +
1.28 m = [4, l, 6]
1.29 +
1.30 +# Test sequence truth value interpretation.
1.31 +
1.32 if x:
1.33 n = l
1.34 else:
1.35 @@ -40,5 +53,17 @@
1.36
1.37 print n # [1, 2, 3]
1.38
1.39 +# Test temporary variable usage at module level.
1.40 +
1.41 a, b, c = h()
1.42 print a, b, c # 7 8 9
1.43 +
1.44 +# Test temporary variable usage in functions.
1.45 +
1.46 +i() # 7 8 9
1.47 +
1.48 +# Test temporary variable usage in classes.
1.49 +
1.50 +class C:
1.51 + a, b, c = h()
1.52 + print a, b, c # 7 8 9