XD-DENG commented on a change in pull request #14416:
URL: https://github.com/apache/airflow/pull/14416#discussion_r582603759



##########
File path: tests/models/test_taskinstance.py
##########
@@ -1488,6 +1488,30 @@ def test_previous_start_date_success(self, _, 
schedule_interval, catchup) -> Non
         assert ti_list[3].get_previous_start_date(state=State.SUCCESS) == 
ti_list[1].start_date
         assert ti_list[3].get_previous_start_date(state=State.SUCCESS) != 
ti_list[2].start_date
 
+    def test_get_previous_start_date_none(self):
+        """
+        Test that get_previous_start_date() can handle TaskInstance with no 
start_date.
+        """
+        with DAG("test_get_previous_start_date_none", start_date=DEFAULT_DATE, 
schedule_interval=None) as dag:
+            task = DummyOperator(task_id="op")
+
+        dag.create_dagrun(
+            execution_date=DEFAULT_DATE,
+            state=State.RUNNING,

Review comment:
       Hi @yuqian90 , thanks for the clarification.
   
   Regarding the 2nd point (`start_date=None`), I agree with you and I think I 
asked a dumb question. So please ignore it :)
   
   Coming back to the first point: I agree with you that there are many 
scenarios that may lead to this situation. My main point is to have clear 
description/comment in the test case so that later people can understand it 
easily (ideally it can cover more than one scenario as well).




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


Reply via email to