airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject [39/45] incubator-airflow git commit: Fix tests for topological sort
Date Mon, 13 Mar 2017 04:45:37 GMT
Fix tests for topological sort


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/57faa530
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/57faa530
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/57faa530

Branch: refs/heads/v1-8-stable
Commit: 57faa530f7e9580cda9bb0200d40af15d323df24
Parents: 1243ab1
Author: Bolke de Bruin <bolke@xs4all.nl>
Authored: Sat Mar 11 13:26:39 2017 -0800
Committer: Bolke de Bruin <bolke@Bolkes-MacBook-Pro.local>
Committed: Sun Mar 12 08:34:53 2017 -0700

----------------------------------------------------------------------
 tests/models.py | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/57faa530/tests/models.py
----------------------------------------------------------------------
diff --git a/tests/models.py b/tests/models.py
index 55117d4..ffd1f31 100644
--- a/tests/models.py
+++ b/tests/models.py
@@ -171,10 +171,20 @@ class DagTest(unittest.TestCase):
         topological_list = dag.topological_sort()
         logging.info(topological_list)
 
-        self.assertTrue(topological_list[0] == op5 or topological_list[0] == op4)
-        self.assertTrue(topological_list[1] == op4 or topological_list[1] == op5)
-        self.assertTrue(topological_list[2] == op1 or topological_list[2] == op2)
-        self.assertTrue(topological_list[3] == op1 or topological_list[3] == op2)
+        set1 = [op4, op5]
+        self.assertTrue(topological_list[0] in set1)
+        set1.remove(topological_list[0])
+
+        set2 = [op1, op2]
+        set2.extend(set1)
+        self.assertTrue(topological_list[1] in set2)
+        set2.remove(topological_list[1])
+
+        self.assertTrue(topological_list[2] in set2)
+        set2.remove(topological_list[2])
+
+        self.assertTrue(topological_list[3] in set2)
+
         self.assertTrue(topological_list[4] == op3)
 
         dag = DAG(


Mime
View raw message