1.1 --- a/tests/dict.py Sun Jan 15 18:59:16 2017 +0100
1.2 +++ b/tests/dict.py Sun Jan 15 22:17:34 2017 +0100
1.3 @@ -18,6 +18,8 @@
1.4 print "d[30]: key not found", exc.key
1.5 print d.get(30) # None
1.6 print d.get(30, "c") # c
1.7 +print d.has_key(20) # True
1.8 +print d.has_key(30) # False
1.9
1.10 l = f(d)
1.11 print "# l: ",
1.12 @@ -60,3 +62,17 @@
1.13 print d[[1, 2]]
1.14 except TypeError:
1.15 print "d[[1, 2]]: key not appropriate"
1.16 +
1.17 +# Attempt to remove items.
1.18 +
1.19 +del d[20]
1.20 +print d.has_key(20) # False
1.21 +try:
1.22 + del d[30] # should fail with an exception
1.23 +except KeyError, exc:
1.24 + print "del d[30]: key not found", exc.key
1.25 +
1.26 +# Clear the dictionary.
1.27 +
1.28 +d.clear()
1.29 +print d # {}