summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_userdict.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2002-11-18 04:34:10 (GMT)
committerRaymond Hettinger <python@rcn.com>2002-11-18 04:34:10 (GMT)
commit8ddc176e2e7ef11b2c46062b29563bc776f177b8 (patch)
tree9420f4a710a3ae47f72c846c0b6f5e0c1a9a29bd /Lib/test/test_userdict.py
parent782d9408667f8df924d865088839633f53cf89bc (diff)
downloadcpython-8ddc176e2e7ef11b2c46062b29563bc776f177b8.zip
cpython-8ddc176e2e7ef11b2c46062b29563bc776f177b8.tar.gz
cpython-8ddc176e2e7ef11b2c46062b29563bc776f177b8.tar.bz2
Improve DictMixin.
Replaced docstring with comments. Prevents subclass contamination. Added the missing __cmp__() method and a test for __cmp__(). Used try/except style in preference to has_key() followed by a look-up. Used iteritem() where possible to save creating a long key list and to save redundant lookups. Expanded .update() to look for the most helpful methods first and gradually work down to a mininum expected interface. Expanded documentation to be more clear on how to use the class.
Diffstat (limited to 'Lib/test/test_userdict.py')
-rw-r--r--Lib/test/test_userdict.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/test/test_userdict.py b/Lib/test/test_userdict.py
index 6f3b853..a59419d 100644
--- a/Lib/test/test_userdict.py
+++ b/Lib/test/test_userdict.py
@@ -210,9 +210,8 @@ else:
s.update({10: 'ten', 20:'twenty'}) # update
verify(s[10]=='ten' and s[20]=='twenty')
-
-
-
-
-
-
+verify(s == {10: 'ten', 20:'twenty'}) # cmp
+t = SeqDict()
+t[20] = 'twenty'
+t[10] = 'ten'
+verify(s == t)