def test_get_cancel_drop_many_pending_readers(self):

    def gen():
        (yield 0.01)
        (yield 0.1)
    loop = self.new_test_loop(gen)
    loop.set_debug(True)
    q = asyncio.Queue(loop=loop)
    reader1 = loop.create_task(q.get())
    reader2 = loop.create_task(q.get())
    reader3 = loop.create_task(q.get())
    loop.run_until_complete(asyncio.sleep(0.01, loop=loop))
    q.put_nowait(1)
    q.put_nowait(2)
    reader1.cancel()
    try:
        loop.run_until_complete(reader1)
    except asyncio.CancelledError:
        pass
    loop.run_until_complete(reader3)
    self.assertEqual({reader2.result(), reader3.result()}, {1, 2})
def test_get_cancel_drop_many_pending_readers(self):

    def gen():
        (yield 0.01)
        (yield 0.1)
    loop = self.new_test_loop(gen)
    loop.set_debug(True)
    q = asyncio.Queue(loop=loop)
    reader1 = loop.create_task(q.get())
    reader2 = loop.create_task(q.get())
    reader3 = loop.create_task(q.get())
    loop.run_until_complete(asyncio.sleep(0.01, loop=loop))
    q.put_nowait(1)
    q.put_nowait(2)
    reader1.cancel()
    try:
        loop.run_until_complete(reader1)
    except asyncio.CancelledError:
        pass
    loop.run_until_complete(reader3)
    self.assertEqual({reader2.result(), reader3.result()}, {1, 2})