1.1 --- a/tests/list.py Sat Jan 28 23:32:15 2017 +0100
1.2 +++ b/tests/list.py Sun Jan 29 00:18:52 2017 +0100
1.3 @@ -42,5 +42,28 @@
1.4 except ValueError, exc:
1.5 print "l.index(4): failed to find argument", exc.value
1.6
1.7 +# Test equality.
1.8 +
1.9 print l == [1, 2, 3] # False
1.10 print l == [1, 2, 3, "four"] # True
1.11 +
1.12 +# Test concatenation.
1.13 +
1.14 +a = [1, 2]
1.15 +a += [3, 4]
1.16 +print a # [1, 2, 3, 4]
1.17 +
1.18 +b = [5, 6]
1.19 +c = a + b
1.20 +print c # [1, 2, 3, 4, 5, 6]
1.21 +
1.22 +# Test removal.
1.23 +
1.24 +print c.pop() # 6
1.25 +print c # [1, 2, 3, 4, 5]
1.26 +
1.27 +d = []
1.28 +try:
1.29 + d.pop() # should raise an exception
1.30 +except IndexError, exc:
1.31 + print "d.pop(): failed to access item", exc.index