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