def test_deleteMax_withNotEmptyTree_shouldDeleteLargestKeyFromTree(self): bst = Treap() for i in range(1, 20): bst.put(-i, i) for i in range(1, 20): bst.delete_max() self.assertEqual(19 - i, len(bst)) self.assertNotIn(-i, bst) for j in range(i + 1, 20): self.assertIn(-j, bst)
def test_deleteMax_withEmptyTree_shouldNotModifyTree(self): bst = Treap() bst.delete_max() self.assertEqual(0, len(bst)) self.assertEqual(-1, bst.height())