Lines Matching full:queue

1 # Some simple queue module tests, plus some failure conditions
2 # to ensure the Queue locks remain stable.
3 import Queue
11 # A thread to run a function that unclogs a blocked Queue.
36 # trigger_func must guarantee to change queue state so that block_func can make
92 raise RuntimeError, "Call this function with an empty queue"
93 # I guess we better check things actually queue correctly a little :)
97 target_order = dict(Queue = [111, 333, 222],
102 "Didn't seem to queue the correct data!")
105 self.assertTrue(not q.empty(), "Queue should not be empty")
106 self.assertTrue(not q.full(), "Queue should not be full")
110 self.assertTrue(q.full(), "Queue should be full")
113 self.fail("Didn't appear to block with a full queue")
114 except Queue.Full:
118 self.fail("Didn't appear to time-out with a full queue")
119 except Queue.Full:
127 self.assertTrue(q.empty(), "Queue should be empty")
130 self.fail("Didn't appear to block with an empty queue")
131 except Queue.Empty:
135 self.fail("Didn't appear to time-out with an empty queue")
136 except Queue.Empty:
167 # Test to make sure a queue task completed successfully.
177 # Test that a queue join()s successfully, and before anything else
190 # Do it a couple of times on the same queue.
198 type2test = Queue.Queue
201 type2test = Queue.LifoQueue
204 type2test = Queue.PriorityQueue
208 # A Queue subclass that can provoke failure at a moment's notice :)
212 class FailingQueue(Queue.Queue):
216 Queue.Queue.__init__(self, *args)
221 return Queue.Queue._put(self, item)
226 return Queue.Queue._get(self)
232 raise RuntimeError, "Call this function with an empty queue"
239 self.fail("The queue didn't fail when it should have")
245 self.fail("The queue didn't fail when it should have")
249 self.assertTrue(q.full(), "Queue should be full")
254 self.fail("The queue didn't fail when it should have")
257 # Check the Queue isn't damaged.
265 self.fail("The queue didn't fail when it should have")
268 # Check the Queue isn't damaged.
271 self.assertTrue(q.full(), "Queue should be full")
273 self.assertTrue(not q.full(), "Queue should not be full")
275 self.assertTrue(q.full(), "Queue should be full")
281 self.assertTrue(q.empty(), "Queue should be empty")
286 self.fail("The queue didn't fail when it should have")
289 self.assertTrue(not q.empty(), "Queue should not be empty")
293 self.fail("The queue didn't fail when it should have")
296 self.assertTrue(not q.empty(), "Queue should not be empty")
298 self.assertTrue(q.empty(), "Queue should be empty")
303 self.fail("The queue didn't fail when it should have")
307 self.assertTrue(not q.empty(), "Queue should not be empty")
309 self.assertTrue(q.empty(), "Queue should be empty")
312 # Test to make sure a queue is functioning correctly.