kaxil commented on code in PR #26134:
URL: https://github.com/apache/airflow/pull/26134#discussion_r962161250


##########
tests/lineage/test_lineage.py:
##########
@@ -118,6 +120,37 @@ def test_lineage_render(self, dag_maker):
         assert op1.inlets[0].url == f1s.format(DEFAULT_DATE)
         assert op1.outlets[0].url == f1s.format(DEFAULT_DATE)
 
+    def test_non_attr_outlet(self, dag_maker):
+        class A:
+            pass
+
+        a = A()
+
+        f3s = "/tmp/does_not_exist_3"
+        file3 = File(f3s)
+
+        with dag_maker(dag_id='test_prepare_lineage'):
+            op1 = EmptyOperator(
+                task_id='leave1',
+                outlets=[a, file3],
+            )
+            op2 = EmptyOperator(task_id='leave2', inlets='auto')
+
+            op1 >> op2
+
+        dag_run = dag_maker.create_dagrun(run_type=DagRunType.SCHEDULED)
+
+        ctx1 = Context({"ti": TI(task=op1, run_id=dag_run.run_id), "ds": 
DEFAULT_DATE})
+        ctx2 = Context({"ti": TI(task=op2, run_id=dag_run.run_id), "ds": 
DEFAULT_DATE})
+
+        # prepare with manual inlets and outlets
+        op1.pre_execute(ctx1)
+        op1.post_execute(ctx1)

Review Comment:
   ```suggestion
           op1.pre_execute(ctx1)
           assert op1.outlets == [a, file3]
           op1.post_execute(ctx1)
   ```



##########
tests/lineage/test_lineage.py:
##########
@@ -118,6 +120,37 @@ def test_lineage_render(self, dag_maker):
         assert op1.inlets[0].url == f1s.format(DEFAULT_DATE)
         assert op1.outlets[0].url == f1s.format(DEFAULT_DATE)
 
+    def test_non_attr_outlet(self, dag_maker):
+        class A:
+            pass
+
+        a = A()
+
+        f3s = "/tmp/does_not_exist_3"
+        file3 = File(f3s)
+
+        with dag_maker(dag_id='test_prepare_lineage'):
+            op1 = EmptyOperator(
+                task_id='leave1',
+                outlets=[a, file3],
+            )
+            op2 = EmptyOperator(task_id='leave2', inlets='auto')
+
+            op1 >> op2
+
+        dag_run = dag_maker.create_dagrun(run_type=DagRunType.SCHEDULED)
+
+        ctx1 = Context({"ti": TI(task=op1, run_id=dag_run.run_id), "ds": 
DEFAULT_DATE})
+        ctx2 = Context({"ti": TI(task=op2, run_id=dag_run.run_id), "ds": 
DEFAULT_DATE})
+
+        # prepare with manual inlets and outlets
+        op1.pre_execute(ctx1)
+        op1.post_execute(ctx1)
+
+        op2.pre_execute(ctx2)
+        assert op2.inlets == [file3]

Review Comment:
   shouldn't this be `[a, file3]`?



##########
tests/lineage/test_lineage.py:
##########
@@ -118,6 +120,37 @@ def test_lineage_render(self, dag_maker):
         assert op1.inlets[0].url == f1s.format(DEFAULT_DATE)
         assert op1.outlets[0].url == f1s.format(DEFAULT_DATE)
 
+    def test_non_attr_outlet(self, dag_maker):
+        class A:
+            pass
+
+        a = A()
+
+        f3s = "/tmp/does_not_exist_3"
+        file3 = File(f3s)
+
+        with dag_maker(dag_id='test_prepare_lineage'):
+            op1 = EmptyOperator(
+                task_id='leave1',
+                outlets=[a, file3],
+            )
+            op2 = EmptyOperator(task_id='leave2', inlets='auto')
+
+            op1 >> op2
+
+        dag_run = dag_maker.create_dagrun(run_type=DagRunType.SCHEDULED)
+
+        ctx1 = Context({"ti": TI(task=op1, run_id=dag_run.run_id), "ds": 
DEFAULT_DATE})
+        ctx2 = Context({"ti": TI(task=op2, run_id=dag_run.run_id), "ds": 
DEFAULT_DATE})
+
+        # prepare with manual inlets and outlets
+        op1.pre_execute(ctx1)
+        op1.post_execute(ctx1)

Review Comment:
   This will verify that non-attr object was indeed set as Outlet



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to