def test__BST_insert(xs): xs = list(set(xs)) bst = BST() for x in xs: bst.insert(x) assert x in bst.to_list('inorder') assert bst.is_bst_satisfied()
def test__BST_remove_and_insert3(xs, ys): ''' This test performs a mixture of both insertions and removals. This ensures that there are no weird interactions between inserting and removing. ''' xs = list(set(xs)) bst = BST(xs) for y in ys: bst.insert(y) x = bst.find_smallest() bst.remove(x) assert bst.is_bst_satisfied()
def test__BST_remove_and_insert1(xs, ys): ''' This test performs a mixture of both insertions and removals. This ensures that there are no weird interactions between inserting and removing. ''' xs = list(set(xs)) bst = BST(xs) for y in ys: bst.insert(y) x = random.choice(bst.to_list('inorder')) bst.remove(x) assert bst.is_bst_satisfied()