async def test_sync_iterate(self): p = BarrierState(reply_to='rt') assert not p.pending assert p.size == 0 await self.adder(p) await self.finalizer(p, 0.0) await self.fulfiller(p) assert p.done() await self.consumer(p)
async def test_iterate__completion(self): p = BarrierState(reply_to='rt') p.done = Mock(name='done') p.done.return_value = False p._results.put_nowait(None) p._results.get = AsyncMock(name='get') def se(): p.done.return_value = True return None p._results.get.coro.side_effect = se assert [x async for x in p.iterate()] == []