def test__as_completed(c, s, a, b): x = c.submit(inc, 1) y = c.submit(inc, 1) z = c.submit(inc, 2) queue = Queue() yield _as_completed([x, y, z], queue) assert queue.qsize() == 3 assert {queue.get(), queue.get(), queue.get()} == {x, y, z} result = yield _first_completed([x, y, z]) assert result in [x, y, z]