summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_itertools.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2005-03-27 20:11:44 (GMT)
committerRaymond Hettinger <python@rcn.com>2005-03-27 20:11:44 (GMT)
commitfdf3bd6630a1797e05124c69ccfb4c07882ae9db (patch)
treefe85082c53bc5ea91bd5b0c8c6be43972ac07c15 /Lib/test/test_itertools.py
parent267b868f23a85c6a63a06452c85487355cf9ab8a (diff)
downloadcpython-fdf3bd6630a1797e05124c69ccfb4c07882ae9db.zip
cpython-fdf3bd6630a1797e05124c69ccfb4c07882ae9db.tar.gz
cpython-fdf3bd6630a1797e05124c69ccfb4c07882ae9db.tar.bz2
SF patch #1171417: bug fix for islice() in docs
Diffstat (limited to 'Lib/test/test_itertools.py')
-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 577082b..5db128c 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -265,6 +265,11 @@ class TestBasicOps(unittest.TestCase):
self.assertEqual(list(islice(xrange(10), 2, None)), range(2, 10))
self.assertEqual(list(islice(xrange(10), 1, None, 2)), range(1, 10, 2))
+ # Test number of items consumed SF #1171417
+ it = iter(range(10))
+ self.assertEqual(list(islice(it, 3)), range(3))
+ self.assertEqual(list(it), range(3, 10))
+
# Test invalid arguments
self.assertRaises(TypeError, islice, xrange(10))
self.assertRaises(TypeError, islice, xrange(10), 1, 2, 3, 4)