def test_consume(self): # full consuming, without limitation r = iters.range(10) self.assertEqual(10, len(list(r))) itr = iter(r) iters.consume(itr) self.assertEqual(0, len(list(itr)))
def test_consume_limited(self): r = iters.range(10) self.assertEqual(10, len(list(r))) itr = iter(r) iters.consume(itr, 5) self.assertEqual(5, len(list(itr)))