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



##########
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:
       On the other hand, a very minor suggestion (let me know if it makes 
sense to you or not :) ): I understand the default `start_date` is `None` for 
`dag.create_dagrun()`, but may be good to explicitly specify `start_date=None` 
here, so it's very straight forward for the people reading this chunk later.




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