def _test_repr_or_str(self, fn, expect_id):
    "Test Queue's repr or str.\n\n        fn is repr or str. expect_id is True if we expect the Queue's id to\n        appear in fn(Queue()).\n        "

    def gen():
        when = (yield)
        self.assertAlmostEqual(0.1, when)
        when = (yield 0.1)
        self.assertAlmostEqual(0.2, when)
        (yield 0.1)
    loop = self.new_test_loop(gen)
    q = asyncio.Queue(loop=loop)
    self.assertTrue(fn(q).startswith('<Queue'), fn(q))
    id_is_present = (hex(id(q)) in fn(q))
    self.assertEqual(expect_id, id_is_present)

    @asyncio.coroutine
    def add_getter():
        q = asyncio.Queue(loop=loop)
        asyncio.Task(q.get(), loop=loop)
        (yield from asyncio.sleep(0.1, loop=loop))
        self.assertTrue(('_getters[1]' in fn(q)))
        q.put_nowait(0)
    loop.run_until_complete(add_getter())

    @asyncio.coroutine
    def add_putter():
        q = asyncio.Queue(maxsize=1, loop=loop)
        q.put_nowait(1)
        asyncio.Task(q.put(2), loop=loop)
        (yield from asyncio.sleep(0.1, loop=loop))
        self.assertTrue(('_putters[1]' in fn(q)))
        q.get_nowait()
    loop.run_until_complete(add_putter())
    q = asyncio.Queue(loop=loop)
    q.put_nowait(1)
    self.assertTrue(('_queue=[1]' in fn(q)))
Test Queue's repr or str.

fn is repr or str. expect_id is True if we expect the Queue's id to
appear in fn(Queue()).
def _test_repr_or_str(self, fn, expect_id):
    "Test Queue's repr or str.\n\n        fn is repr or str. expect_id is True if we expect the Queue's id to\n        appear in fn(Queue()).\n        "

    def gen():
        when = (yield)
        self.assertAlmostEqual(0.1, when)
        when = (yield 0.1)
        self.assertAlmostEqual(0.2, when)
        (yield 0.1)
    loop = self.new_test_loop(gen)
    q = asyncio.Queue(loop=loop)
    self.assertTrue(fn(q).startswith('<Queue'), fn(q))
    id_is_present = (hex(id(q)) in fn(q))
    self.assertEqual(expect_id, id_is_present)

    @asyncio.coroutine
    def add_getter():
        q = asyncio.Queue(loop=loop)
        asyncio.Task(q.get(), loop=loop)
        (yield from asyncio.sleep(0.1, loop=loop))
        self.assertTrue(('_getters[1]' in fn(q)))
        q.put_nowait(0)
    loop.run_until_complete(add_getter())

    @asyncio.coroutine
    def add_putter():
        q = asyncio.Queue(maxsize=1, loop=loop)
        q.put_nowait(1)
        asyncio.Task(q.put(2), loop=loop)
        (yield from asyncio.sleep(0.1, loop=loop))
        self.assertTrue(('_putters[1]' in fn(q)))
        q.get_nowait()
    loop.run_until_complete(add_putter())
    q = asyncio.Queue(loop=loop)
    q.put_nowait(1)
    self.assertTrue(('_queue=[1]' in fn(q)))