[Python-checkins] python/dist/src/Lib/test test_weakref.py,1.17,1.17.4.1
mwh@users.sourceforge.net
mwh@users.sourceforge.net
Fri, 23 Aug 2002 09:29:30 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv19232
Modified Files:
Tag: release22-maint
test_weakref.py
Log Message:
backport gvanrossum's checkin of
revision 1.19 of test_weakref.py
SF patch 564549 (Erik Andersén).
The WeakKeyDictionary constructor didn't work when a dict arg was
given. Fixed by moving a line. Also adding a unit test.
Bugfix candidate.
Index: test_weakref.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v
retrieving revision 1.17
retrieving revision 1.17.4.1
diff -C2 -d -r1.17 -r1.17.4.1
*** test_weakref.py 19 Dec 2001 16:54:23 -0000 1.17
--- test_weakref.py 23 Aug 2002 16:29:27 -0000 1.17.4.1
***************
*** 376,379 ****
--- 376,390 ----
self.assert_(len(values) == 0, "itervalues() did not touch all values")
+ def test_make_weak_keyed_dict_from_dict(self):
+ o = Object(3)
+ dict = weakref.WeakKeyDictionary({o:364})
+ self.assert_(dict[o] == 364)
+
+ def test_make_weak_keyed_dict_from_weak_keyed_dict(self):
+ o = Object(3)
+ dict = weakref.WeakKeyDictionary({o:364})
+ dict2 = weakref.WeakKeyDictionary(dict)
+ self.assert_(dict[o] == 364)
+
def make_weak_keyed_dict(self):
dict = weakref.WeakKeyDictionary()