mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
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
This commit is contained in:
parent
397b45d4ba
commit
f0c5aec85f
2 changed files with 21 additions and 9 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue