summaryrefslogtreecommitdiff
path: root/taskflow/patterns
diff options
context:
space:
mode:
authorIvan A. Melnikov <imelnikov@griddynamics.com>2014-03-21 17:07:03 +0400
committerIvan A. Melnikov <imelnikov@griddynamics.com>2014-03-22 19:22:00 +0400
commit261d69a75915f869b2e7bf351c47f202c725837c (patch)
tree256c4686b20bff1388f2abd55ce3a71044fa49a9 /taskflow/patterns
parentd162c82d44d1a6f4a7833e5f14c438f1a480239e (diff)
downloadtaskflow-261d69a75915f869b2e7bf351c47f202c725837c.tar.gz
Rework graph flow unit tests
This commit adds unit tests that check graph flow methods without executing or flattening it. Now-redundant tests from other test suites are deleted. Change-Id: I8dafe0f9b295428831eddb3f9fd48f042d2f1ffc
Diffstat (limited to 'taskflow/patterns')
-rw-r--r--taskflow/patterns/graph_flow.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/taskflow/patterns/graph_flow.py b/taskflow/patterns/graph_flow.py
index a835e0b..decf356 100644
--- a/taskflow/patterns/graph_flow.py
+++ b/taskflow/patterns/graph_flow.py
@@ -41,16 +41,6 @@ class Flow(flow.Flow):
super(Flow, self).__init__(name, retry)
self._graph = nx.freeze(nx.DiGraph())
- def _validate(self, graph=None):
- if graph is None:
- graph = self._graph
- # Ensure that there is a valid topological ordering.
- if not nx.is_directed_acyclic_graph(graph):
- raise exc.DependencyFailure("No path through the items in the"
- " graph produces an ordering that"
- " will allow for correct dependency"
- " resolution")
-
def link(self, u, v):
"""Link existing node u as a runtime dependency of existing node v."""
if not self._graph.has_node(u):
@@ -86,7 +76,11 @@ class Flow(flow.Flow):
with a frozen version of the replacement graph (this maintains the
invariant that the underlying graph is immutable).
"""
- self._validate(replacement_graph)
+ if not nx.is_directed_acyclic_graph(replacement_graph):
+ raise exc.DependencyFailure("No path through the items in the"
+ " graph produces an ordering that"
+ " will allow for correct dependency"
+ " resolution")
self._graph = nx.freeze(replacement_graph)
def add(self, *items):