

@gen_test
def test_task_done(self):
    q = self.queue_class()
    for i in range(100):
        q.put_nowait(i)
    q.accumulator = 0

    @gen.coroutine
    def worker():
        while True:
            item = (yield q.get())
            self.accumulator += item
            q.task_done()
            (yield gen.sleep((random() * 0.01)))
    worker()
    worker()
    (yield q.join())
    self.assertEqual(sum(range(100)), self.accumulator)

dataset/ETHPy150Open tornadoweb/tornado/tornado/test/queues_test.py QueueJoinTest.test_task_done/VarMisuse@39/47 `self`->`q`