async def test_compress_gen(self): data = "abcdefghijkl" selectors = ait.cycle([1, 0, 0]) it = ait.compress(data, selectors) for k in ["a", "d", "g", "j"]: self.assertEqual(await ait.next(it), k) with self.assertRaises(StopAsyncIteration): await ait.next(it)
async def test_compress_list(self): data = range(10) selectors = [0, 1, 1, 0, 0, 0, 1, 0, 1, 0] it = ait.compress(data, selectors) for k in [1, 2, 6, 8]: self.assertEqual(await ait.next(it), k) with self.assertRaises(StopAsyncIteration): await ait.next(it)