uranusjr commented on code in PR #22941:
URL: https://github.com/apache/airflow/pull/22941#discussion_r851116781


##########
tests/decorators/test_python.py:
##########
@@ -506,6 +506,62 @@ def add_2(number: int):
 
         assert ret.operator.doc_md.strip(), "Adds 2 to number."
 
+    def test_user_provided_task_id_in_a_loop_is_used(self):
+        """Tests that when looping that user provided task_id is used"""
+
+        @task_decorator(task_id='hello_task')
+        def hello():
+            """
+            Print Hello world
+            """
+            print("Hello world")
+
+        with self.dag:
+            for i in range(3):
+                hello.override(task_id=f'my_task_id_{i * 2}')()

Review Comment:
   Let’s add a `hello()` after the loop to ensure `hello_task` is still usable 
(not mutated) after `override` is called.



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