Exemplo n.º 1
0
def test_node_copy():
    node = Node('root')

    copy = node.copy()
    copy.parent = node

    assert isinstance(copy, Node)
    assert copy.path == 'root'
    assert copy.full_path == ('root', 'root')
Exemplo n.º 2
0
def test_node_hierarchy():
    root = Node('root')
    child = Node('child')

    child.parent = root

    assert child.parent is root
    assert child.path == 'child'
    assert child.full_path == ('root', 'child')
    assert repr(child) == "<Node {'path': root.child}>"