def test_get_cancel_drop_one_pending_reader(self):

    def gen():
        (yield 0.01)
        (yield 0.1)
    loop = self.new_test_loop(gen)
    q = asyncio.Queue(loop=loop)
    reader = loop.create_task(q.get())
    loop.run_until_complete(asyncio.sleep(0.01, loop=loop))
    q.put_nowait(1)
    q.put_nowait(2)
    reader.cancel()
    try:
        loop.run_until_complete(reader)
    except asyncio.CancelledError:
        reader = loop.create_task(q.get())
        loop.run_until_complete(reader)
    result = reader.result()
    self.assertEqual(1, result)
def test_get_cancel_drop_one_pending_reader(self):

    def gen():
        (yield 0.01)
        (yield 0.1)
    loop = self.new_test_loop(gen)
    q = asyncio.Queue(loop=loop)
    reader = loop.create_task(q.get())
    loop.run_until_complete(asyncio.sleep(0.01, loop=loop))
    q.put_nowait(1)
    q.put_nowait(2)
    reader.cancel()
    try:
        loop.run_until_complete(reader)
    except asyncio.CancelledError:
        reader = loop.create_task(q.get())
        loop.run_until_complete(reader)
    result = reader.result()
    self.assertEqual(1, result)