Add keyword argument support to itertools.count().

This commit is contained in:
Raymond Hettinger 2009-02-14 00:25:51 +00:00
parent 544c3e19e6
commit a4038038c6
3 changed files with 10 additions and 9 deletions

View file

@ -347,6 +347,8 @@ class TestBasicOps(unittest.TestCase):
def test_count_with_stride(self):
self.assertEqual(zip('abc',count(2,3)), [('a', 2), ('b', 5), ('c', 8)])
self.assertEqual(zip('abc',count(start=2,step=3)),
[('a', 2), ('b', 5), ('c', 8)])
self.assertEqual(zip('abc',count(2,0)), [('a', 2), ('b', 2), ('c', 2)])
self.assertEqual(zip('abc',count(2,1)), [('a', 2), ('b', 3), ('c', 4)])
self.assertEqual(take(20, count(maxsize-15, 3)), take(20, range(maxsize-15, maxsize+100, 3)))