예제 #1
0
파일: test_at.py 프로젝트: dbew/treebeard
def test_del_at_non_existent_path(example_tree):
    with pytest.raises(AttributeError):
        del_at(example_tree, ('does', 'not', 'exist'))
예제 #2
0
파일: test_at.py 프로젝트: dbew/treebeard
def test_del_at_non_existent_leaf(example_tree):
    with pytest.raises(AttributeError):
        del_at(example_tree, ('foo', 'bar', 'new_node'))
예제 #3
0
파일: test_at.py 프로젝트: dbew/treebeard
def test_del_at_empty_path(example_tree):
    with pytest.raises(ValueError):
        del_at(example_tree, [])
예제 #4
0
파일: test_at.py 프로젝트: dbew/treebeard
def test_del_at_empty_path_in_empty_tree():
    with pytest.raises(ValueError):
        del_at(Tree(), [])
예제 #5
0
파일: test_at.py 프로젝트: dbew/treebeard
def test_del_at_can_remove_a_subtree(example_tree):
    pre_exisiting_paths = {path for path, _ in walk(example_tree)}
    del_at(example_tree, ('foo', 'bar'))
    assert {path for path, _ in walk(example_tree)} == pre_exisiting_paths - {('foo', 'bar', 'baz'),
                                                                           ('foo', 'bar', 'bang')}