Exemplo n.º 1
0
def test_delete_leaf(animal):
    cat = animal.get('cat')
    lion = animal.get('lion')

    animal.delete('lion')

    assert lion not in cat._children
    assert lion._parent is None
Exemplo n.º 2
0
def test_delete_from_the_middle(animal):
    cat = animal.get('cat')
    lion = animal.get('lion')

    animal.delete('cat/lion')

    assert lion not in cat._children
    assert lion._parent is None
Exemplo n.º 3
0
def test_delete_3_nodes_path(animal):
    cat = animal.get('cat')
    lion = animal.get('lion')

    animal.delete('mammal/cat/lion')

    assert lion not in cat._children
    assert lion._parent is None
Exemplo n.º 4
0
def test_delete_2_nodes_path(animal):
    mammal = animal.get('mammal')
    cat = animal.get('cat')

    animal.delete('mammal/cat')

    assert cat not in mammal._children
    assert cat._parent is None
Exemplo n.º 5
0
def test_delete_1_node_path(animal):
    animal.delete('mammal')
    assert animal._children == []
Exemplo n.º 6
0
def test_delete_root(animal):
    with pytest.raises(RootDeleteError):
        animal.delete('animal')