diff options
author | Fred Drake <fdrake@acm.org> | 2001-08-03 04:11:27 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-08-03 04:11:27 (GMT) |
commit | 4fd06e0170aa75e4873b73f733bfd3f3de19d967 (patch) | |
tree | fc63ca7a172058454f2354727e6b17c16fb635c1 /Lib/test | |
parent | 5d548796474d63db729903cd67a21e0a9f1e6666 (diff) | |
download | cpython-4fd06e0170aa75e4873b73f733bfd3f3de19d967.zip cpython-4fd06e0170aa75e4873b73f733bfd3f3de19d967.tar.gz cpython-4fd06e0170aa75e4873b73f733bfd3f3de19d967.tar.bz2 |
Make sure that WeakValueDictionary[] raises KeyError instead of TypeError
for keys that are not in the dictionary.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_weakref.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py index bb4ce76..341d53f 100644 --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -252,6 +252,11 @@ class MappingTestCase(TestBase): del objects, o self.assert_(len(dict) == 0, "deleting the values did not clear the dictionary") + # regression on SF bug #447152: + dict = weakref.WeakValueDictionary() + self.assertRaises(KeyError, dict.__getitem__, 1) + dict[2] = C() + self.assertRaises(KeyError, dict.__getitem__, 2) def test_weak_keys(self): # |