@asyncio.coroutine
def test():
    t = asyncio.Task(putter(), loop=loop)
    (yield from asyncio.sleep(0.01, loop=loop))
    self.assertEqual([0, 1], have_been_put)
    self.assertEqual(0, q.get_nowait())
    (yield from asyncio.sleep(0.01, loop=loop))
    self.assertEqual([0, 1, 2], have_been_put)
    self.assertEqual(1, q.get_nowait())
    self.assertEqual(2, q.get_nowait())
    self.assertTrue(t.done())
    self.assertTrue(t.result())
@asyncio.coroutine
def test():
    t = asyncio.Task(putter(), loop=loop)
    (yield from asyncio.sleep(0.01, loop=loop))
    self.assertEqual([0, 1], have_been_put)
    self.assertEqual(0, q.get_nowait())
    (yield from asyncio.sleep(0.01, loop=loop))
    self.assertEqual([0, 1, 2], have_been_put)
    self.assertEqual(1, q.get_nowait())
    self.assertEqual(2, q.get_nowait())
    self.assertTrue(t.done())
    self.assertTrue(t.result())