def test_map_tree_to_tree(test_tree: Tree): assert test_tree.map_tree_to_tree(lambda tree: Tree(name=tree.name, data=tree.data + 1000)) == \ test_tree.map_data_to_data(lambda data: data + 1000)
def test_map_tree_to_data(test_tree: Tree): assert test_tree.map_tree_to_data(lambda tree: tree.data + 1000) == \ test_tree.map_data_to_data(lambda data: data + 1000)
def test_map_tree_to_name_and_data(test_tree: Tree): assert test_tree.map_tree_to_name_and_data(lambda tree: (tree.name, tree.data + 1000)) == \ test_tree.map_data_to_data(lambda data: data + 1000)
def test_map_data_to_data(test_tree: Tree): assert test_tree.map_data_to_data( lambda data: data + 1000).flatten_data() == [ 1000, 1001, 1011, 1002, 1021, 1022, 1003, 1031, 1032, 1033, 1331 ]