[Python-checkins] CVS: python/dist/src/Lib/test test_weakref.py,1.2,1.3

Fred L. Drake fdrake@users.sourceforge.net
Wed, 28 Feb 2001 19:06:55 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv8838/test

Modified Files:
	test_weakref.py 
Log Message:

Add tests for the .copy() methods of both weak dictionary classes.


Index: test_weakref.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** test_weakref.py	2001/02/27 18:36:56	1.2
--- test_weakref.py	2001/03/01 03:06:53	1.3
***************
*** 150,153 ****
--- 150,160 ----
      verify(o is dict[o.arg],
             "wrong object returned by weak dict!")
+ items1 = dict.items()
+ items2 = dict.copy().items()
+ items1.sort()
+ items2.sort()
+ verify(items1 == items2,
+        "cloning of weak-valued dictionary did not work!")
+ del items1, items2
  dict.clear()
  print "weak dict test complete"
***************
*** 166,170 ****
      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"
--- 173,184 ----
      verify(o.arg is dict[o],
             "wrong object returned by weak dict!")
! items1 = dict.items()
! items2 = dict.copy().items()
! items1.sort()
! items2.sort()
! verify(items1 == items2,
!        "cloning of weak-keyed dictionary did not work!")
! del items1, items2
! del objects, o
  verify(len(dict)==0, "deleting the keys did not clear the dictionary")
  print "weak key dict test complete"