summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorKristjan Valur Jonsson <sweskman@gmail.com>2011-03-30 11:04:28 (GMT)
committerKristjan Valur Jonsson <sweskman@gmail.com>2011-03-30 11:04:28 (GMT)
commit35722a93768e942be31270fe60acff138d878b26 (patch)
treefb473822ae05deb7d91424fefcc7ce4b09d1bd37 /Lib
parentad45bfe2d390eb94cf6d0e91b97c1db4bef2a2a9 (diff)
downloadcpython-35722a93768e942be31270fe60acff138d878b26.zip
cpython-35722a93768e942be31270fe60acff138d878b26.tar.gz
cpython-35722a93768e942be31270fe60acff138d878b26.tar.bz2
Bugfix: Properly test for errors from PyLong_AsLong() in itertools.cycle.
ti can raise an exception even if PyLong_Check() has succeeded.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_itertools.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index da101e1..9ce54d0 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -339,6 +339,8 @@ class TestBasicOps(unittest.TestCase):
list(range(maxsize-5, maxsize+5)))
self.assertEqual(list(islice(count(-maxsize-5), 10)),
list(range(-maxsize-5, -maxsize+5)))
+ self.assertEqual(list(islice(count(10, maxsize+5), 3)),
+ list(range(10, 10+3*(maxsize+5), maxsize+5)))
c = count(3)
self.assertEqual(repr(c), 'count(3)')
next(c)
@@ -361,6 +363,9 @@ class TestBasicOps(unittest.TestCase):
self.assertEqual(next(copy.deepcopy(c)), value)
self.assertEqual(next(pickle.loads(pickle.dumps(c))), value)
+ #check proper internal error handling for large "step' sizes
+ count(1, maxsize+5); sys.exc_info()
+
def test_count_with_stride(self):
self.assertEqual(lzip('abc',count(2,3)), [('a', 2), ('b', 5), ('c', 8)])
self.assertEqual(lzip('abc',count(start=2,step=3)),