def test_retry_iterator_one(self): it = apilint._retry_iterator([1]) self.assertEqual(it.next(), 1) it.send("retry") self.assertEqual(it.next(), 1) with self.assertRaises(StopIteration): it.next()
def test_retry_iterator(self): it = apilint._retry_iterator([1, 2, 3, 4]) self.assertEqual(it.next(), 1) self.assertEqual(it.next(), 2) self.assertEqual(it.next(), 3) it.send("retry") self.assertEqual(it.next(), 3) self.assertEqual(it.next(), 4) with self.assertRaises(StopIteration): it.next()