Пример #1
0
    async def test_product_gen(self):
        async def gen(x):
            yield x
            yield x + 1

        it = ait.product(gen(1), gen(6))
        for k in [(1, 6), (1, 7), (2, 6), (2, 7)]:
            self.assertEqual(await ait.next(it), k)
        with self.assertRaises(StopAsyncIteration):
            await ait.next(it)
Пример #2
0
 async def test_product_list(self):
     it = ait.product([1, 2], [6, 7])
     for k in [(1, 6), (1, 7), (2, 6), (2, 7)]:
         self.assertEqual(await ait.next(it), k)
     with self.assertRaises(StopAsyncIteration):
         await ait.next(it)