From 055950cdbfcac3b39b89a88b6f4ea1a321a40b06 Mon Sep 17 00:00:00 2001 From: Steve Ahn Date: Thu, 27 Nov 2025 13:21:12 -0800 Subject: [PATCH] fix string to datetime pydantic and test --- task-sdk/src/airflow/sdk/api/client.py | 2 +- task-sdk/tests/task_sdk/api/test_client.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/task-sdk/src/airflow/sdk/api/client.py b/task-sdk/src/airflow/sdk/api/client.py index 0e8703b4ba338..3054c8a809f54 100644 --- a/task-sdk/src/airflow/sdk/api/client.py +++ b/task-sdk/src/airflow/sdk/api/client.py @@ -289,7 +289,7 @@ def get_previous_successful_dagrun(self, id: uuid.UUID) -> PrevSuccessfulDagRunR def get_reschedule_start_date(self, id: uuid.UUID, try_number: int = 1) -> TaskRescheduleStartDate: """Get the start date of a task reschedule via the API server.""" resp = self.client.get(f"task-reschedules/{id}/start_date", params={"try_number": try_number}) - return TaskRescheduleStartDate.model_construct(start_date=resp.json()) + return TaskRescheduleStartDate(start_date=resp.json()) def get_count( self, diff --git a/task-sdk/tests/task_sdk/api/test_client.py b/task-sdk/tests/task_sdk/api/test_client.py index be75d6ee1cd4f..67d5c713f8a4f 100644 --- a/task-sdk/tests/task_sdk/api/test_client.py +++ b/task-sdk/tests/task_sdk/api/test_client.py @@ -1267,7 +1267,7 @@ def handle_request(request: httpx.Request) -> httpx.Response: result = client.task_instances.get_reschedule_start_date(id=ti_id, try_number=1) assert isinstance(result, TaskRescheduleStartDate) - assert result.start_date == "2024-01-01T00:00:00Z" + assert result.start_date == datetime(2024, 1, 1, 0, 0, 0, tzinfo=timezone.utc) class TestHITLOperations: