def test_resolve_dependencies(self, edges): dag = DirectedGraph.from_edges(edges) if DirectedGraph._is_cyclic(dag): with self.assertRaises(CyclicDependencyError): _ = EOWorkflow._schedule_dependencies(dag) else: ver2pos = {u: i for i, u in enumerate(EOWorkflow._schedule_dependencies(dag))} self.assertTrue(functools.reduce( lambda P, Q: P and Q, [ver2pos[u] < ver2pos[v] for u, v in edges] ))
def test_resolve_dependencies(edges): graph = DirectedGraph.from_edges(edges) if DirectedGraph._is_cyclic(graph): with pytest.raises(CyclicDependencyError): graph.toplogically_ordered_vertices() else: vertex_position = { vertex: i for i, vertex in enumerate(graph.toplogically_ordered_vertices()) } assert functools.reduce( lambda P, Q: P and Q, [vertex_position[u] < vertex_position[v] for u, v in edges])