Beispiel #1
0
def test_traverser():
    graph = generate_dep_graph(foo_pipeline)
    traverser = Traverser(graph)

    assert traverser.fetch_upstream(item_name='return_one', depth=1) == set()
    assert traverser.fetch_downstream(item_name='return_one',
                                      depth=1) == set(['add_nums'])
    assert traverser.fetch_upstream(item_name='multiply_two', depth=0) == set()
    assert traverser.fetch_upstream(item_name='multiply_two', depth=2) == set(
        ['add_nums', 'return_one', 'return_two'], )
    assert traverser.fetch_downstream(item_name='multiply_two',
                                      depth=2) == set(['add_one'])
Beispiel #2
0
def test_traverser():
    graph = generate_dep_graph(foo_pipeline)
    traverser = Traverser(graph)

    assert traverser.fetch_upstream(item_name="return_one", depth=1) == set()
    assert traverser.fetch_downstream(item_name="return_one", depth=1) == {"add_nums"}
    assert traverser.fetch_upstream(item_name="multiply_two", depth=0) == set()
    assert traverser.fetch_upstream(item_name="multiply_two", depth=2) == {
        "add_nums",
        "return_one",
        "return_two",
    }
    assert traverser.fetch_downstream(item_name="multiply_two", depth=2) == {"add_one"}