コード例 #1
0
    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))
コード例 #2
0
 def test_non_iterable(self):
     non_iters = [False, True, 9, 4.5, object()]
     for i in non_iters:
         self.assertFalse(core._is_iter(i))
コード例 #3
0
 def test_list(self):
     self.assertTrue(core._is_iter([1, 2, 3]))