summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_itertools.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-10-26 14:25:56 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-10-26 14:25:56 (GMT)
commitf0c5aec85f30ed16d1a8b4d3113bd056881bbf6f (patch)
tree0bfda0ad7b4f1835382bca871e0e7ccc77327a54 /Lib/test/test_itertools.py
parent397b45d4bacc057884c8ba18f83ef15d9bfb6149 (diff)
downloadcpython-f0c5aec85f30ed16d1a8b4d3113bd056881bbf6f.zip
cpython-f0c5aec85f30ed16d1a8b4d3113bd056881bbf6f.tar.gz
cpython-f0c5aec85f30ed16d1a8b4d3113bd056881bbf6f.tar.bz2
Minor improvements to itertools.tee():
* tee object is no longer subclassable * independent iterators renamed to "itertools.tee_iterator" * fixed doc string typo and added entry in the module doc string
Diffstat (limited to 'Lib/test/test_itertools.py')
-rw-r--r--Lib/test/test_itertools.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index ce03b1a..e12aa41 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -243,6 +243,18 @@ class TestBasicOps(unittest.TestCase):
self.assertRaises(TypeError, tee, 3)
self.assertRaises(TypeError, tee, [1,2], 'x')
+ try:
+ class A(tee): pass
+ except TypeError:
+ pass
+ else:
+ self.fail("tee constructor should not be subclassable")
+
+ # tee_iterator should not be instantiable
+ a, b = tee(xrange(10))
+ self.assertRaises(TypeError, type(a))
+ self.assert_(a is iter(a)) # tee_iterator should support __iter__
+
def test_StopIteration(self):
self.assertRaises(StopIteration, izip().next)