class Priority_Q_Min_Heap_Test_Add_Get_Multiple_Entries(unittest.TestCase):
    def setUp(self):
        self._item_priority_entries = []

        for letter in string.uppercase:  #build letter, ord(letter) tuples
            self._item_priority_entries.append((letter, ord(letter)))

        self._priorityQ = PriorityQueue(reverse_priority=True)

        self._expected_order_of_items_from_get = []
        for letter in string.uppercase:  #build Z, Y, X, .....C, B , A because this is a max heap.
            self._expected_order_of_items_from_get.append(letter)

    def test_add_get_multiple_entries(self):
        for item, priority in self._item_priority_entries:
            self._priorityQ.add_item(item, priority)

        items_from_q = []
        for i in range(len(
                self._item_priority_entries)):  #get this many items from the Q
            items_from_q.append(self._priorityQ.get())

        self.assertEqual(items_from_q, self._expected_order_of_items_from_get,
                         'Items from priority Q did not match expected list.')

    def tearDown(self):
        self._priorityQ = None
class Priority_Q_Min_Heap_Test_Get_With_Empty_Q(unittest.TestCase):
    def setUp(self):
        self._priorityQ = PriorityQueue(reverse_priority=True)

    def test_priority_q_test_add_element(self):
        self.assertEqual(self._priorityQ.get(), None,
                         'Empty Q must return None on get op')

    def tearDown(self):
        self._priorityQ = None
class Priority_Q_Min_Heap_Test_Q_Add_And_Get_With_Single_Entry(
        unittest.TestCase):
    def setUp(self):
        self._item = 'Some Item'
        self._priority = 2
        self._priorityQ = PriorityQueue(reverse_priority=True)

    def test_priority_q_test_add__and_get(self):
        self._priorityQ.add_item(self._item, self._priority)
        item = self._priorityQ.get()
        self.assertEqual(item, self._item,
                         'Get op on priority Q did not yield expected item')

    def tearDown(self):
        self._priorityQ = None