示例#1
0
def test_create_binary_tree_with_list_and_insert_list():
    binary_tree = BinaryTree([4, 7])
    assert isinstance(binary_tree, BinaryTree)
    binary_tree.add([5, 6, 8])
    assert binary_tree.level_order_traversal() == [4, 7, 5, 6, 8]
示例#2
0
def test_create_binary_tree():
    binary_tree = BinaryTree()
    assert isinstance(binary_tree, BinaryTree)
示例#3
0
def test_create_binary_tree_with_int_and_insert_list():
    binary_tree = BinaryTree(3)
    assert isinstance(binary_tree, BinaryTree)
    binary_tree.add([4, 5])
    assert binary_tree.level_order_traversal() == [3, 4, 5]
示例#4
0
def test_level_order_traversal_from_inserted_list():
    binary_tree = BinaryTree([4, 5, 6, 7, 8, 9])
    assert binary_tree.level_order_traversal() == [4, 5, 6, 7, 8, 9]
示例#5
0
def test_level_order_traversal_from_inserted_int():
    binary_tree = BinaryTree(4)
    assert binary_tree.level_order_traversal() == [4]
示例#6
0
def test_create_binary_tree_passing_list():
    binary_tree = BinaryTree([4, 5, 6, 7])
    assert isinstance(binary_tree, BinaryTree)
示例#7
0
def test_create_binary_tree_passing_int():
    binary_tree = BinaryTree(4)
    assert isinstance(binary_tree, BinaryTree)