diff options
author | Raymond Hettinger <python@rcn.com> | 2003-02-07 05:32:58 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-02-07 05:32:58 (GMT) |
commit | 2012f174ea305dfab6eefc35add748b87bb239ad (patch) | |
tree | 2afbed3905a5bdb5ed3596d4df42de1ff3cb0011 /Lib/test/test_itertools.py | |
parent | 2b09bc4d571c29ff044d9170156a89e77adb8f61 (diff) | |
download | cpython-2012f174ea305dfab6eefc35add748b87bb239ad.zip cpython-2012f174ea305dfab6eefc35add748b87bb239ad.tar.gz cpython-2012f174ea305dfab6eefc35add748b87bb239ad.tar.bz2 |
SF bug #681003: itertools issues
* Fixed typo in exception message for times()
* Filled in missing times_traverse()
* Document reasons that imap() did not adopt a None fill-in feature
* Document that count(sys.maxint) will wrap-around on overflow
* Add overflow test to islice()
* Check that starmap()'s argument returns a tuple
* Verify that imap()'s tuple re-use is safe
* Make a similar tuple re-use (with safety check) for izip()
Diffstat (limited to 'Lib/test/test_itertools.py')
-rw-r--r-- | Lib/test/test_itertools.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py index 1239301..cef1718 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 * +import sys class TestBasicOps(unittest.TestCase): def test_count(self): @@ -47,6 +48,7 @@ class TestBasicOps(unittest.TestCase): import operator self.assertEqual(list(starmap(operator.pow, zip(range(3), range(1,7)))), [0**1, 1**2, 2**3]) + self.assertRaises(TypeError, list, starmap(operator.pow, [[4,5]])) def test_islice(self): for args in [ # islice(args) should agree with range(args) @@ -71,6 +73,7 @@ class TestBasicOps(unittest.TestCase): self.assertRaises(ValueError, islice, xrange(10), 1, -5, -1) self.assertRaises(ValueError, islice, xrange(10), 1, 10, -1) self.assertRaises(ValueError, islice, xrange(10), 1, 10, 0) + self.assertEqual(len(list(islice(count(), 1, 10, sys.maxint))), 1) def test_takewhile(self): data = [1, 3, 5, 20, 2, 4, 6, 8] |