summaryrefslogtreecommitdiff
path: root/taskflow/tests
diff options
context:
space:
mode:
authorMichal Arbet <michal.arbet@ultimum.io>2018-06-25 16:06:18 +0200
committerMichal Arbet <michal.arbet@ultimum.io>2018-07-11 13:11:51 +0200
commitd985c5a256bcf8f67e80235ba387599f448f2c49 (patch)
treeb7f5f712a08a83090aefb43d4b0ce121fc6d2fca /taskflow/tests
parent19d0eb89c80655da766b6fc55b3ebf6b5a0d52f8 (diff)
downloadtaskflow-d985c5a256bcf8f67e80235ba387599f448f2c49.tar.gz
Fix code to support networkx > 1.0
With the release of NetworkX 2.0 the reporting API was moved to view/iterator model. Many methods were moved from reporting lists or dicts to iterating over the information. Methods that used to return containers now return views and methods that returned iterators have been removed in networkx. Because of this change in NetworkX 2.0 , taskflow code have to be changed also to support networkx > 2.0 Change-Id: I23c226f37bd85c1e38039fbcb302a2d0de49f333 Closes-Bug: #1778115
Diffstat (limited to 'taskflow/tests')
-rw-r--r--taskflow/tests/unit/action_engine/test_compile.py4
-rw-r--r--taskflow/tests/unit/test_types.py12
2 files changed, 8 insertions, 8 deletions
diff --git a/taskflow/tests/unit/action_engine/test_compile.py b/taskflow/tests/unit/action_engine/test_compile.py
index 1a310d1..fb99439 100644
--- a/taskflow/tests/unit/action_engine/test_compile.py
+++ b/taskflow/tests/unit/action_engine/test_compile.py
@@ -73,7 +73,7 @@ class PatternCompileTest(test.TestCase):
compiler.PatternCompiler(flo).compile())
self.assertEqual(8, len(g))
- order = g.topological_sort()
+ order = list(g.topological_sort())
self.assertEqual(['test', 'a', 'b', 'c',
"sub-test", 'd', "sub-test[$]",
'test[$]'], order)
@@ -430,7 +430,7 @@ class PatternCompileTest(test.TestCase):
self.assertTrue(g.has_edge(flow, a))
self.assertTrue(g.has_edge(a, empty_flow))
- empty_flow_successors = g.successors(empty_flow)
+ empty_flow_successors = list(g.successors(empty_flow))
self.assertEqual(1, len(empty_flow_successors))
empty_flow_terminal = empty_flow_successors[0]
self.assertIs(empty_flow, empty_flow_terminal.flow)
diff --git a/taskflow/tests/unit/test_types.py b/taskflow/tests/unit/test_types.py
index ba9d8fe..f1e84d1 100644
--- a/taskflow/tests/unit/test_types.py
+++ b/taskflow/tests/unit/test_types.py
@@ -576,12 +576,12 @@ CEO
self.assertEqual(root.child_count(only_direct=False) + 1, len(g))
for node in root.dfs_iter(include_self=True):
self.assertIn(node.item, g)
- self.assertEqual([], g.predecessors('animal'))
- self.assertEqual(['animal'], g.predecessors('reptile'))
- self.assertEqual(['primate'], g.predecessors('human'))
- self.assertEqual(['mammal'], g.predecessors('primate'))
- self.assertEqual(['animal'], g.predecessors('mammal'))
- self.assertEqual(['mammal', 'reptile'], g.successors('animal'))
+ self.assertEqual([], list(g.predecessors('animal')))
+ self.assertEqual(['animal'], list(g.predecessors('reptile')))
+ self.assertEqual(['primate'], list(g.predecessors('human')))
+ self.assertEqual(['mammal'], list(g.predecessors('primate')))
+ self.assertEqual(['animal'], list(g.predecessors('mammal')))
+ self.assertEqual(['mammal', 'reptile'], list(g.successors('animal')))
def test_to_digraph_retains_metadata(self):
root = tree.Node("chickens", alive=True)