Added optional None arguments to itertools.islice().

This commit is contained in:
Raymond Hettinger 2004-12-05 09:25:51 +00:00
parent d2f70cbe8e
commit b2594050ea
4 changed files with 27 additions and 14 deletions

View file

@ -260,6 +260,8 @@ class TestBasicOps(unittest.TestCase):
# Test stop=None
self.assertEqual(list(islice(xrange(10), None)), range(10))
self.assertEqual(list(islice(xrange(10), None, None)), range(10))
self.assertEqual(list(islice(xrange(10), None, None, None)), range(10))
self.assertEqual(list(islice(xrange(10), 2, None)), range(2, 10))
self.assertEqual(list(islice(xrange(10), 1, None, 2)), range(1, 10, 2))