Beispiel #1
0
 def test_push(self):
     stack = Heap()
     stack.push(4)
     stack.push(5)
     stack.push(1)
     stack.push(2)
     self.assertEqual(stack.pop(), 1)
Beispiel #2
0
 def test_emptyException(self):
     stack = Heap()
     with self.assertRaises(EmptyHeap) as context:
         stack.pop()
         self.assertTrue('Heap is empty', context.exception)