Exemple #1
0
    def test_priority(self, queue):
        """Ensure tasks are given back in order of priority."""
        queue.put('foo')
        queue.put('bar', priority=30)
        queue.put('dar', priority=100)

        assert queue.get() == 'bar'
        assert queue.get() == 'foo'
        assert queue.get() == 'dar'
Exemple #2
0
    def test_queue(self, queue):
        """Ensure you can put stuff on the queue and get it back."""
        queue.put('foo')
        queue.put('bar')
        queue.put('dar')
        assert len(queue) == 3

        assert queue.get() == 'foo'
        assert queue.get() == 'bar'
        assert queue.get() == 'dar'
        assert len(queue) == 0
Exemple #3
0
 def test_empty_queue(self, queue):
     """Ensure methods work when the queue is empty."""
     assert len(queue) == 0
     assert not queue.get()
     assert len(queue) == 0