def test_get_cancelled(self):

    def gen():
        when = (yield)
        self.assertAlmostEqual(0.01, when)
        when = (yield 0.01)
        self.assertAlmostEqual(0.061, when)
        (yield 0.05)
    loop = self.new_test_loop(gen)
    q = asyncio.Queue(loop=loop)

    @asyncio.coroutine
    def queue_get():
        return (yield from asyncio.wait_for(q.get(), 0.051, loop=loop))

    @asyncio.coroutine
    def test():
        get_task = asyncio.Task(queue_get(), loop=loop)
        (yield from asyncio.sleep(0.01, loop=loop))
        q.put_nowait(1)
        return (yield from get_task)
    self.assertEqual(1, loop.run_until_complete(test()))
    self.assertAlmostEqual(0.06, loop.time())
def test_get_cancelled(self):

    def gen():
        when = (yield)
        self.assertAlmostEqual(0.01, when)
        when = (yield 0.01)
        self.assertAlmostEqual(0.061, when)
        (yield 0.05)
    loop = self.new_test_loop(gen)
    q = asyncio.Queue(loop=loop)

    @asyncio.coroutine
    def queue_get():
        return (yield from asyncio.wait_for(q.get(), 0.051, loop=loop))

    @asyncio.coroutine
    def test():
        get_task = asyncio.Task(queue_get(), loop=loop)
        (yield from asyncio.sleep(0.01, loop=loop))
        q.put_nowait(1)
        return (yield from get_task)
    self.assertEqual(1, loop.run_until_complete(test()))
    self.assertAlmostEqual(0.06, loop.time())