def test_tree_bfs(): bt = BinaryTree() bt.root = Node(6) bt.root.right = Node(5) bt.root.left = Node(-1) bt.root.right.left = Node(7) bt.root.left.left = Node(10) bt.root.right.right = Node(3) assert bt.breadthFirst() == [6, -1, 5, 10, 7, 3]
def test_tree_bfs_empty(): bt = BinaryTree() with pytest.raises(Exception): assert bt.breadthFirst()