Ejemplo n.º 1
0
def test_three_forked_done():
    dag = {
        'a': Activity(),
        'b': Activity(deps=set('a')),
        'c': Activity(deps=set('a'))
    }
    path, already_done = find_path(dag, {'b'}, done={'a'})
    assert ['b'] == path
    assert ['a'] == already_done
    path, already_done = find_path(dag, {'c'}, done={'a'})
    assert ['c'] == path
    assert ['a'] == already_done
    path, already_done = find_path(dag, {'b', 'c'}, done={'a'})
    assert ['b', 'c'] == path
    assert ['a'] == already_done
Ejemplo n.º 2
0
def test_five_forked_done():
    dag = {
        'a': Activity(),
        'b': Activity(deps=set('a')),
        'c': Activity(deps=set('b')),
        'd': Activity(deps=set('a')),
        'e': Activity(deps=set('c'))
    }
    path, already_done = find_path(dag, {'d'}, done={'a'})
    assert ['d'] == path
    assert ['a'] == already_done
    path, already_done = find_path(dag, {'e'}, done={'b'})
    assert ['c', 'e'] == path
    assert ['b'] == already_done
    path, already_done = find_path(dag, {'d', 'e'}, done={'a', 'b'})
    assert ['d', 'c', 'e'] == path
    assert ['a', 'b'] == already_done
    path, already_done = find_path(dag, {'b', 'c', 'd', 'e'}, done={'a', 'c'})
    assert ['b', 'd', 'e'] == path
    assert ['c', 'a'] == already_done
Ejemplo n.º 3
0
def test_single():
    path, _ = find_path({'a': Activity()}, {'a'})
    assert ['a'] == path