def test_generator(self): g = (i for i in range(4)) self.assertTrue(core._is_iter(g)) # Can't consume self.assertEqual([0, 1, 2, 3], list(g))
def test_non_iterable(self): non_iters = [False, True, 9, 4.5, object()] for i in non_iters: self.assertFalse(core._is_iter(i))
def test_list(self): self.assertTrue(core._is_iter([1, 2, 3]))