def test_two_values_no_fizz():
    tree = BinaryTree()
    tree.root = Node(4)
    tree.root.left = Node(23)

    assert fizz_buzz_tree(tree).root.value == '4'
    assert fizz_buzz_tree(tree).root.left.value == '23'
def test_three_values_no_fizz():
    tree = BinaryTree()
    tree.root = Node(4)
    tree.root.left = Node(23)
    tree.root.right = Node(19)

    assert fizz_buzz_tree(tree).root.value == '4'
    assert fizz_buzz_tree(tree).root.left.value == '23'
    assert fizz_buzz_tree(tree).root.right.value == '19'
Exemple #3
0
def test_fizz_buzz():
    bt = BinaryTree()
    bt.root = Node(3)
    bt.root.right = Node(5)
    bt.root.left = Node(15)
    bt.root.left.left = Node(1)
    actual = FizzBuzzTree(bt)
    expect = ['Fizz', 'FizzBuzz', 1, 'Buzz']
    assert actual == expect
def test_tree():
    tree = BinaryTree()
    tree.root = Node(5)
    tree.root.left = Node(1)
    tree.root.right = Node(15)
    tree.root.left.left = Node(21)
    tree.root.left.right = Node(4)
    tree.root.right.right = Node(20)
    tree.root.left.left.left = Node(6)
    tree.root.right.right.left = Node(10)
    return tree
def test_fizz_buzz():
    tree = BinaryTree()
    tree.root = Node(17)
    tree.root.left = Node(15)
    tree.root.right = Node(5)
    tree.root.right.left = Node(9)

    assert fizz_buzz_tree(tree).root.value == '17'
    assert fizz_buzz_tree(tree).root.left.value == 'FizzBuzz'
    assert fizz_buzz_tree(tree).root.right.value == 'Buzz'
    assert fizz_buzz_tree(tree).root.right.left.value == 'Fizz'