def test_removing_min_until_empty(self):
     initialization_list = [100, 75, 125, -30, 150, 40, 20, 130]
     tree = BSTree(initialization_list)
     removed_values = []
     while tree.size > 0:
         min_value = tree.min()
         removed_values.append(min_value)
         tree.remove(min_value)
     self.assertEqual(removed_values, sorted(initialization_list))
 def test_bst_size(self):
     tree = BSTree()
     self.assertEqual(tree.size, 0)
     tree.insert(100)
     self.assertEqual(tree.size, 1)
     tree.insert(200)
     tree.insert(50)
     self.assertEqual(tree.size, 3)
     tree.remove(100)
     self.assertEqual(tree.size, 2)
 def test_removing_root_promotes_successor(self):
     tree = BSTree([100, 75, 50, 95, 125, 150, 110])
     tree.remove(100)
     root = next(tree.pre_order_traversal())
     self.assertEqual(root.value, 110)
 def test_removes_return_boolean_result(self):
     tree = BSTree([100, 75, 125])
     self.assertTrue(tree.remove(100))
     self.assertFalse(tree.remove(100))