RoyLee1224 commented on code in PR #55735:
URL: https://github.com/apache/airflow/pull/55735#discussion_r2376453877


##########
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_run.py:
##########
@@ -178,23 +194,45 @@ def get_dag_versions_dict(dag_versions: list[DagVersion]) 
-> list[dict]:
     ]
 
 
+def format_datetime_like_api(dt: datetime | None) -> str | None:
+    """
+    Format datetime to match API output behavior.
+
+    The API serializes datetimes with microseconds only when they are non-zero:
+    - 2024-01-15T00:00:00Z (for times with zero microseconds)
+    - 2024-01-15T00:01:40.500000Z (for times with non-zero microseconds)
+
+    This function ensures test expectations match the actual API behavior.
+    If API datetime serialization changes in the future, only this function 
needs updating.
+

Review Comment:
   To be honest, I'm getting some odd test results caused by the time formats.
   
   Still trying to figure it out. I'll update the test after having a better 
understand with it.



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