def test_xmaxheap_pushpop_method_lower_priority(self): mh = XMaxHeap({'first': 'test'}) mh.push('first', 2) result = mh.pushpop('second', 1) self.assertEqual(len(mh), 1) self.assertEqual(result, 'first') # get the highest priority item back result2 = mh.pop() self.assertEqual(result2, 'second')
def test_xmaxheap_pushpop_method(self): mh = XMaxHeap({'first': 'test'}) mh.push('first', 1) result = mh.pushpop('second', 2) self.assertEqual(len(mh), 1) self.assertEqual(result, 'second') # get the highest priority item back, even if it is the one that was just placed on queue result2 = mh.pop() self.assertEqual(result2, 'first')
def test_xmaxheap_pushpop_method(self): mh = XMaxHeap({'first': 'test'}) mh.push('first', 1) result = mh.pushpop('second', 2) self.assertEqual(len(mh), 1) self.assertEqual( result, 'second' ) # get the highest priority item back, even if it is the one that was just placed on queue result2 = mh.pop() self.assertEqual(result2, 'first')