[Python-checkins] CVS: python/dist/src/Lib/test test_weakref.py,1.1,1.2
Martin v. L?wis
loewis@users.sourceforge.net
Tue, 27 Feb 2001 10:36:58 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv22846/Lib/test
Modified Files:
test_weakref.py
Log Message:
Patch #403985: Add support for weak-keyed dictionaries
Index: test_weakref.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** test_weakref.py 2001/02/01 05:25:27 1.1
--- test_weakref.py 2001/02/27 18:36:56 1.2
***************
*** 154,157 ****
--- 154,175 ----
print
+ print "Weak Keyed Dictionaries"
+
+ dict = weakref.mapping(weakkeys=1)
+ objects = map(Object, range(10))
+ for o in objects:
+ dict[o] = o.arg
+ print "objects are stored in weak dict"
+ for o in objects:
+ verify(weakref.getweakrefcount(o) == 1,
+ "wrong number of weak references to %r!" % o)
+ verify(o.arg is dict[o],
+ "wrong object returned by weak dict!")
+ del objects,o
+ verify(len(dict)==0, "deleting the keys did not clear the dictionary")
+ print "weak key dict test complete"
+
+
+ print
print "Non-callable Proxy References"
print "XXX -- tests not written!"