コード例 #1
0
 def test_close(self):
     # Verify that the queue can be closed.
     q = ClosableDeferredQueue()
     q.close("testing")
     self.assertEqual(q.closed, "testing")
     self.assertEqual(q.waiting, [])
     self.assertEqual(q.pending, [])
コード例 #2
0
 def test_get_closed(self):
     # Verify that the .get() method errbacks when the queue is closed.
     q = ClosableDeferredQueue()
     q.closed = RuntimeError("testing")
     d = self.assertFailure(q.get(), RuntimeError)
     d.addCallback(lambda e: self.assertEqual(e.args[0], "testing"))
     return d
コード例 #3
0
ファイル: twisted_adapter_tests.py プロジェクト: pika/pika
 def test_close_twice(self):
     # If a queue it called twice, it must not crash.
     q = ClosableDeferredQueue()
     q.close("testing")
     self.assertEqual(q.closed, "testing")
     q.close("testing")
     self.assertEqual(q.closed, "testing")
コード例 #4
0
ファイル: twisted_adapter_tests.py プロジェクト: pika/pika
 def test_close(self):
     # Verify that the queue can be closed.
     q = ClosableDeferredQueue()
     q.close("testing")
     self.assertEqual(q.closed, "testing")
     self.assertEqual(q.waiting, [])
     self.assertEqual(q.pending, [])
コード例 #5
0
ファイル: twisted_adapter_tests.py プロジェクト: pika/pika
 def test_get_closed(self):
     # Verify that the .get() method errbacks when the queue is closed.
     q = ClosableDeferredQueue()
     q.closed = RuntimeError("testing")
     d = self.assertFailure(q.get(), RuntimeError)
     d.addCallback(lambda e: self.assertEqual(e.args[0], "testing"))
     return d
コード例 #6
0
 def test_close_waiting(self):
     # Verify that the deferred waiting for new data are errbacked when the
     # queue is closed.
     q = ClosableDeferredQueue()
     d = q.get()
     q.close(RuntimeError("testing"))
     self.assertTrue(q.closed)
     self.assertEqual(q.waiting, [])
     self.assertEqual(q.pending, [])
     return self.assertFailure(d, RuntimeError)
コード例 #7
0
ファイル: twisted_adapter_tests.py プロジェクト: pika/pika
 def test_close_waiting(self):
     # Verify that the deferred waiting for new data are errbacked when the
     # queue is closed.
     q = ClosableDeferredQueue()
     d = q.get()
     q.close(RuntimeError("testing"))
     self.assertTrue(q.closed)
     self.assertEqual(q.waiting, [])
     self.assertEqual(q.pending, [])
     return self.assertFailure(d, RuntimeError)
コード例 #8
0
 def test_close_twice(self):
     # If a queue it called twice, it must not crash.
     q = ClosableDeferredQueue()
     q.close("testing")
     self.assertEqual(q.closed, "testing")
     q.close("testing")
     self.assertEqual(q.closed, "testing")