diff options
author | Raymond Hettinger <python@rcn.com> | 2004-10-17 16:40:14 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-10-17 16:40:14 (GMT) |
commit | a9f609290431ae1e03148b814ee55972d8f9d43e (patch) | |
tree | f917c843f4128a5eb87c3d0502b19e5b249a3ce6 /Lib/test | |
parent | 837dd93e3b038b80bc65c85352e5196097220388 (diff) | |
download | cpython-a9f609290431ae1e03148b814ee55972d8f9d43e.zip cpython-a9f609290431ae1e03148b814ee55972d8f9d43e.tar.gz cpython-a9f609290431ae1e03148b814ee55972d8f9d43e.tar.bz2 |
Fix and test weak referencing of itertools.tee objects.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_itertools.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py index aa80910..0f74c62 100644 --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -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 @@ class TestBasicOps(unittest.TestCase): 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) |