[Python-checkins] python/dist/src/Lib/test test_deque.py, 1.11, 1.12 test_set.py, 1.11, 1.12

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Sun May 30 03:26:51 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv735/Lib/test
Modified Files:
	test_deque.py test_set.py 
Log Message:
Make sets and deques weak referencable.
Index: test_deque.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_deque.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** test_deque.py	19 May 2004 08:20:08 -0000	1.11
--- test_deque.py	30 May 2004 07:26:47 -0000	1.12
***************
*** 2,5 ****
--- 2,6 ----
 import unittest
 from test import test_support
+ from weakref import proxy
 import copy
 import cPickle as pickle
***************
*** 436,439 ****
--- 437,446 ----
 self.assertEqual(list(d), list(e))
 
+ def test_weakref(self):
+ d = deque('gallahad')
+ p = proxy(d)
+ self.assertEqual(str(p), str(d))
+ d = None
+ self.assertRaises(ReferenceError, str, p)
 
 #==============================================================================
Index: test_set.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_set.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** test_set.py	12 Feb 2004 17:35:11 -0000	1.11
--- test_set.py	30 May 2004 07:26:47 -0000	1.12
***************
*** 1,4 ****
--- 1,5 ----
 import unittest
 from test import test_support
+ from weakref import proxy
 import operator
 import copy
***************
*** 347,350 ****
--- 348,358 ----
 self.assert_(c not in self.s)
 
+ def test_weakref(self):
+ s = self.thetype('gallahad')
+ p = proxy(s)
+ self.assertEqual(str(p), str(s))
+ s = None
+ self.assertRaises(ReferenceError, str, p)
+ 
 class SetSubclass(set):
 pass


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /