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
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
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
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
def test_delete_1_node_path(animal): animal.delete('mammal') assert animal._children == []
def test_delete_root(animal): with pytest.raises(RootDeleteError): animal.delete('animal')