def test_fizz_buzz_tree(): my_tree = BinarySearchTree() my_tree.add(10) my_tree.add(4) my_tree.add(15) assert my_tree.fizz_buzz_tree(my_tree.root) == ['Buzz',4,'FizzBuzz']
def test_fizzbuzz(): bst = BinarySearchTree() bst.add(1) bst.add(3) bst.add(5) bst.add(7) bst.add(11) bst.add(15) bst.add(34) expected = [1, 'Fizz', 'Buzz', 7, 11, 'FizzBuzz', 34] actual = FizzBuzzTree(bst) assert actual == expected
def test_Values(): tree = BinarySearchTree() tree.add(15) tree.add(10) tree.add(27) tree.add(17) tree.add(1) assert fizzbuzz_tree(tree)._root.value == 'FizzBuzz' assert fizzbuzz_tree(tree)._root.left.value == 'Buzz' assert fizzbuzz_tree(tree)._root.right.value == 'Fizz' assert fizzbuzz_tree(tree)._root.left.left.value == '1' assert fizzbuzz_tree(tree)._root.right.left.value == '17'
def test_fizzbuzz_and_beyond(): bst = BinarySearchTree() bst.add(15) bst.add(15) bst.add(15) expected = ['FizzBuzz', 'FizzBuzz', 'FizzBuzz'] actual = FizzBuzzTree(bst) assert actual == expected
def test_nofizzbuzz(): bst = BinarySearchTree() bst.add(2) bst.add(4) bst.add(7) bst.add(8) expected = [2, 4, 7, 8] actual = FizzBuzzTree(bst) assert actual == expected
def test_tree_one_member(): tree = BinarySearchTree() tree.add('apples') assert tree.root.value == 'apples'
def test_empty_list(): tree = BinarySearchTree() assert fizzbuzz_tree(tree)._root == None
def bst(): return BinarySearchTree()