diff options
author | Raymond Hettinger <python@rcn.com> | 2002-12-11 07:16:06 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2002-12-11 07:16:06 (GMT) |
commit | 0efa17c94386c957cf63aad7d2d513c14cd8fd4a (patch) | |
tree | 6da9406af85a5a11eb52cd88694fadee5b1f47ff /Lib/test/test_userdict.py | |
parent | d2bef8256bf7ce6bea7a80074cbd021b5af154af (diff) | |
download | cpython-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.py | 8 |
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) |