[Python-checkins] CVS: python/dist/src/Lib/test test_weakref.py,1.9,1.10
Fred L. Drake
fdrake@users.sourceforge.net
Thu, 02 Aug 2001 21:11:29 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv1950/test
Modified Files:
test_weakref.py
Log Message:
Make sure that WeakValueDictionary[] raises KeyError instead of TypeError
for keys that are not in the dictionary.
Index: test_weakref.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** test_weakref.py 2001/05/10 17:16:38 1.9
--- test_weakref.py 2001/08/03 04:11:27 1.10
***************
*** 253,256 ****
--- 253,261 ----
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):