Issue #10323: Predictable final state for slice().

This commit is contained in:
Raymond Hettinger 2010-11-30 03:15:35 +00:00
parent 1fea5c4472
commit 061bf7a11a
3 changed files with 13 additions and 3 deletions

View file

@ -778,6 +778,11 @@ class TestBasicOps(unittest.TestCase):
self.assertRaises(ValueError, islice, xrange(10), 1, 'a', 1)
self.assertEqual(len(list(islice(count(), 1, 10, maxsize))), 1)
# Issue #10323: Less islice in a predictable state
c = count()
self.assertEqual(list(islice(c, 1, 3, 50)), [1])
self.assertEqual(next(c), 3)
def test_takewhile(self):
data = [1, 3, 5, 20, 2, 4, 6, 8]
underten = lambda x: x<10