async def test_get_nowait(tasks, get_size, expected_tasks): q = TaskQueue() await q.add(tasks) batch, tasks = q.get_nowait(get_size) assert tasks == expected_tasks q.complete(batch, tasks) assert all(task not in q for task in tasks)
def test_get_nowait_queuefull(get_size): q = TaskQueue() with pytest.raises(asyncio.QueueFull): q.get_nowait(get_size)