Exemple #1
0
 def test_not_empty(self):
     """
     A queue with one enqueued value is not empty.
     """
     pq = NaivePriorityQueue()
     pq.enqueue(Job(1, 'People'))
     self.assertFalse(pq.is_empty())
Exemple #2
0
 def test_empty_after_dequeue(self):
     """
     A queue with one enqueued value is empty after dequeuing.
     """
     pq = NaivePriorityQueue()
     pq.enqueue(Job(1, 'was'))
     _ = pq.dequeue()
     self.assertTrue(pq.is_empty())
Exemple #3
0
 def test_not_empty_multiple(self):
     """
     A queue with two enqueued values is not empty after dequeuing only one.
     """
     pq = NaivePriorityQueue()
     pq.enqueue(Job(1, 'hustling'))
     pq.enqueue(Job(3, 'arguing and bustling'))
     _ = pq.dequeue()
     self.assertFalse(pq.is_empty())
Exemple #4
0
 def test_empty(self):
     """
     A queue is initially empty.
     """
     pq = NaivePriorityQueue()
     self.assertTrue(pq.is_empty())