[Python-checkins] python/dist/src/Lib/test test_itertools.py, 1.38, 1.39

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Sun Mar 27 22:11:48 CEST 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17250/Lib/test

Modified Files:
	test_itertools.py 
Log Message:
SF patch #1171417:  bug fix for islice() in docs



Index: test_itertools.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- test_itertools.py	11 Mar 2005 22:17:30 -0000	1.38
+++ test_itertools.py	27 Mar 2005 20:11:44 -0000	1.39
@@ -265,6 +265,11 @@
         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)



More information about the Python-checkins mailing list