Exemple #1
0
def test_remove_node():
    p = Pipeline()
    a = p.run('nop')
    b = p.run('nop')
    c = p.run('nop')
    p.add_edge(c, b)
    p.add_edge(b, a)
    p.remove(b)
    assert len(p._nodes) == 2
    assert len(p._edges) == 0
    for node in p.nodes():
        assert len(node._edges) == 0
def test_remove_node():
    p = Pipeline()
    a = p.run('nop')
    b = p.run('nop')
    c = p.run('nop')
    p.add_edge(c, b)
    p.add_edge(b, a)
    p.remove(b)
    assert len(p._nodes) == 2
    assert len(p._edges) == 0
    for node in p.nodes():
        assert len(node._edges) == 0
def test_topological_sort():
    p = Pipeline()
    a = p.run('nop')
    assert a.name == "nop"
    b = p.run('nop')
    assert a.name == "nop.0"
    assert b.name == "nop.1"
    c = p.run('nop')
    assert a.name == "nop.0"
    assert b.name == "nop.1"
    assert c.name == "nop.2"
    p.add_edge(c, b)
    p.add_edge(b, a)
    sorted_nodes = [n for n in p.topological_order()]
    assert sorted_nodes == [c, b, a]
Exemple #4
0
def test_topological_sort():
    p = Pipeline()
    a = p.run('nop')
    assert a.name == "nop"
    b = p.run('nop')
    assert a.name == "nop.0"
    assert b.name == "nop.1"
    c = p.run('nop')
    assert a.name == "nop.0"
    assert b.name == "nop.1"
    assert c.name == "nop.2"
    p.add_edge(c, b)
    p.add_edge(b, a)
    sorted_nodes = [n for n in p.topological_order()]
    assert sorted_nodes == [c, b, a]
def test_edge_equality():
    p = Pipeline()
    a = p.run('nop')
    b = p.run('nop')
    assert p.add_edge(a, b) is not None
    assert p.add_edge(a, b) is not None
    assert len(p._edges) == 1
Exemple #6
0
def test_edge_equality():
    p = Pipeline()
    a = p.run('nop')
    b = p.run('nop')
    assert p.add_edge(a, b) is not None
    assert p.add_edge(a, b) is not None
    assert len(p._edges) == 1
def test_graph_create():
    p = Pipeline()
    a = p.run('nop')
    b = p.run('nop')
    p.run('nop')
    assert len(p._nodes) == 3
    assert p.add_edge(a, b) is not None
    assert len(p._edges) == 1
Exemple #8
0
def test_graph_create():
    p = Pipeline()
    a = p.run('nop')
    b = p.run('nop')
    p.run('nop')
    assert len(p._nodes) == 3
    assert p.add_edge(a, b) is not None
    assert len(p._edges) == 1
def test_missing_node_for_edge_insert():
    p = Pipeline()
    assert p.add_edge("A", "B") is None
Exemple #10
0
def test_missing_node_for_edge_insert():
    p = Pipeline()
    assert p.add_edge("A", "B") is None