Exemplo n.º 1
0
def test_exception():
    results = run_graph(get_graph(boom))
    assert boom not in results
    assert boom in results.exceptions
Exemplo n.º 2
0
#!/usr/bin/env python
from rulz import plugin, run_graph


@plugin()
def one():
    return 1


@plugin()
def two():
    return 2


@plugin(one, two)
def add(a, b):
    return a + b


if __name__ == "__main__":
    print(run_graph())
Exemplo n.º 3
0
def test_optional_opt():
    results = run_graph(get_graph(three_opt))
    assert results[three_opt] == 3
Exemplo n.º 4
0
def test_optional_good():
    results = run_graph(get_graph(six))
    assert results[six] == 6
Exemplo n.º 5
0
def test_at_least_one_again():
    results = run_graph(get_graph(at_least_one_again))
    assert results[at_least_one_again] == 3
    assert boom not in results
Exemplo n.º 6
0
def test_at_least_one():
    results = run_graph(get_graph(at_least_one))
    assert results[at_least_one] == 3
    assert boom not in results
Exemplo n.º 7
0
def test_requirements():
    results = run_graph(get_graph(add))
    assert results[add] == 3