def test_exception(): results = run_graph(get_graph(boom)) assert boom not in results assert boom in results.exceptions
#!/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())
def test_optional_opt(): results = run_graph(get_graph(three_opt)) assert results[three_opt] == 3
def test_optional_good(): results = run_graph(get_graph(six)) assert results[six] == 6
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
def test_at_least_one(): results = run_graph(get_graph(at_least_one)) assert results[at_least_one] == 3 assert boom not in results
def test_requirements(): results = run_graph(get_graph(add)) assert results[add] == 3