summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_userdict.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2002-12-11 07:16:06 (GMT)
committerRaymond Hettinger <python@rcn.com>2002-12-11 07:16:06 (GMT)
commit0efa17c94386c957cf63aad7d2d513c14cd8fd4a (patch)
tree6da9406af85a5a11eb52cd88694fadee5b1f47ff /Lib/test/test_userdict.py
parentd2bef8256bf7ce6bea7a80074cbd021b5af154af (diff)
downloadcpython-0efa17c94386c957cf63aad7d2d513c14cd8fd4a.zip
cpython-0efa17c94386c957cf63aad7d2d513c14cd8fd4a.tar.gz
cpython-0efa17c94386c957cf63aad7d2d513c14cd8fd4a.tar.bz2
Clean-up test class for DictMixin.
Diffstat (limited to 'Lib/test/test_userdict.py')
-rw-r--r--Lib/test/test_userdict.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/test/test_userdict.py b/Lib/test/test_userdict.py
index e61238f..a7541c8 100644
--- a/Lib/test/test_userdict.py
+++ b/Lib/test/test_userdict.py
@@ -155,8 +155,12 @@ class SeqDict(DictMixin):
raise KeyError
return self.valuelist[i]
def __setitem__(self, key, value):
- self.keylist.append(key)
- self.valuelist.append(value)
+ try:
+ i = self.keylist.index(key)
+ self.valuelist[i] = value
+ except ValueError:
+ self.keylist.append(key)
+ self.valuelist.append(value)
def __delitem__(self, key):
try:
i = self.keylist.index(key)