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


##########
airflow-core/tests/unit/models/test_mappedoperator.py:
##########
@@ -1401,3 +1401,49 @@ def t3(a):
     dr.task_instance_scheduling_decisions()
     ti3 = dr.get_task_instance(task_id="tg1.t3")
     assert not ti3.state
+
+
+def test_mapped_operator_retry_delay_default(dag_maker):
+    """
+    Test that MappedOperator.retry_delay returns default value when not 
explicitly set.
+
+    This test verifies the fix for a KeyError that occurred when accessing 
retry_delay
+    on a MappedOperator without an explicit retry_delay value in 
partial_kwargs.
+    The property should fall back to SerializedBaseOperator.retry_delay (300 
seconds).
+    """
+    import datetime
+
+    with dag_maker(dag_id="test_retry_delay", serialized=True) as dag:
+        # Create a mapped operator without explicitly setting retry_delay
+        MockOperator.partial(task_id="mapped_task").expand(arg2=[1, 2, 3])
+
+    # Get the deserialized mapped task
+    mapped_deser = dag.task_dict["mapped_task"]
+
+    # Accessing retry_delay should not raise KeyError
+    # and should return the default value (300 seconds)
+    assert mapped_deser.retry_delay == datetime.timedelta(seconds=300)
+
+
+def test_mapped_operator_retry_delay_explicit(dag_maker):
+    """
+    Test that MappedOperator.retry_delay returns explicit value when set.
+
+    This test verifies that when retry_delay is explicitly set in partial(),
+    the MappedOperator returns that value instead of the default.
+    """
+    import datetime

Review Comment:
   this should go at the top



##########
airflow-core/tests/unit/models/test_mappedoperator.py:
##########
@@ -1401,3 +1401,49 @@ def t3(a):
     dr.task_instance_scheduling_decisions()
     ti3 = dr.get_task_instance(task_id="tg1.t3")
     assert not ti3.state
+
+
+def test_mapped_operator_retry_delay_default(dag_maker):
+    """
+    Test that MappedOperator.retry_delay returns default value when not 
explicitly set.
+
+    This test verifies the fix for a KeyError that occurred when accessing 
retry_delay
+    on a MappedOperator without an explicit retry_delay value in 
partial_kwargs.
+    The property should fall back to SerializedBaseOperator.retry_delay (300 
seconds).
+    """
+    import datetime

Review Comment:
   this should go at the top
   
   
   



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