MCPcopy
hub / github.com/tornadoweb/tornado / test_repr_and_str

Method test_repr_and_str

tornado/test/queues_test.py:24–45  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

22
23class QueueBasicTest(AsyncTestCase):
24 def test_repr_and_str(self):
25 q = queues.Queue(maxsize=1) # type: queues.Queue[None]
26 self.assertIn(hex(id(q)), repr(q))
27 self.assertNotIn(hex(id(q)), str(q))
28 q.get()
29
30 for q_str in repr(q), str(q):
31 self.assertTrue(q_str.startswith("<Queue"))
32 self.assertIn("maxsize=1", q_str)
33 self.assertIn("getters[1]", q_str)
34 self.assertNotIn("putters", q_str)
35 self.assertNotIn("tasks", q_str)
36
37 q.put(None)
38 q.put(None)
39 # Now the queue is full, this putter blocks.
40 q.put(None)
41
42 for q_str in repr(q), str(q):
43 self.assertNotIn("getters", q_str)
44 self.assertIn("putters[1]", q_str)
45 self.assertIn("tasks=2", q_str)
46
47 def test_order(self):
48 q = queues.Queue() # type: queues.Queue[int]

Callers

nothing calls this directly

Calls 2

getMethod · 0.95
putMethod · 0.95

Tested by

no test coverage detected