[Python-checkins] python/dist/src/Lib/test test_itertools.py, 1.35, 1.36

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Sun Oct 17 18:40:16 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4458/Lib/test
Modified Files:
	test_itertools.py 
Log Message:
Fix and test weak referencing of itertools.tee objects.
Index: test_itertools.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- test_itertools.py	29 Sep 2004 11:40:50 -0000	1.35
+++ test_itertools.py	17 Oct 2004 16:40:14 -0000	1.36
@@ -1,6 +1,7 @@
 import unittest
 from test import test_support
 from itertools import *
+from weakref import proxy
 import sys
 import operator
 import random
@@ -382,6 +383,13 @@
 t3 = tnew(t1)
 self.assert_(list(t1) == list(t2) == list(t3) == list('abc'))
 
+ # test that tee objects are weak referencable
+ a, b = tee(xrange(10))
+ p = proxy(a)
+ self.assertEqual(getattr(p, '__class__'), type(b))
+ del a
+ self.assertRaises(ReferenceError, getattr, p, '__class__')
+
 def test_StopIteration(self):
 self.assertRaises(StopIteration, izip().next)
 


More information about the Python-checkins mailing list

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