zhongjiajie commented on a change in pull request #4779: [AIRFLOW-3958] List 
tasks upstream work in chain
URL: https://github.com/apache/airflow/pull/4779#discussion_r284064725
 
 

 ##########
 File path: tests/utils/test_helpers.py
 ##########
 @@ -248,6 +248,16 @@ def test_cross_downstream(self):
         for start_task in start_tasks:
             six.assertCountEqual(self, 
start_task.get_direct_relatives(upstream=False), end_tasks)
 
+    def test_chain(self):
+        dag = DAG(dag_id='test_chain', start_date=datetime.now())
+        [t1, t2, t3, t4, t5, t6] = [DummyOperator(task_id='t{i}'.format(i=i), 
dag=dag) for i in range(1, 7)]
+        helpers.chain(t1, [t2, t3], [t4, t5], t6)
+
+        self.assertCountEqual([t2, t3], 
t1.get_direct_relatives(upstream=False))
+        self.assertEqual([t4], t2.get_direct_relatives(upstream=False))
+        self.assertEqual([t5], t3.get_direct_relatives(upstream=False))
+        self.assertCountEqual([t4, t5], t6.get_direct_relatives(upstream=True))
+
 
 Review comment:
   I add more test on different length of iterable and between not two iterable

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to