mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Make sure that WeakValueDictionary[] raises KeyError instead of TypeError
for keys that are not in the dictionary.
This commit is contained in:
parent
5d54879647
commit
4fd06e0170
2 changed files with 6 additions and 1 deletions
|
@ -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):
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue