From 8d0c61737f5fcf506b7f9b93dbd96a11a2af3f54 Mon Sep 17 00:00:00 2001 From: lda Date: Wed, 9 Sep 2026 22:19:50 +0700 Subject: [PATCH] chore: clean up scheduling review diagnostics --- tests/scheduling/test_schedule_store.py | 14 +++++++------- tests/wf_transport_rpc_http/test_rpc_models.py | 8 +++++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/scheduling/test_schedule_store.py b/tests/scheduling/test_schedule_store.py index 04dabacd..20cb1f9b 100644 --- a/tests/scheduling/test_schedule_store.py +++ b/tests/scheduling/test_schedule_store.py @@ -140,10 +140,9 @@ def test_candidate_is_at_most_one(tmp_path: Path) -> None: ) store.save_candidate(first, schedule_id="a") store.save_candidate(second, schedule_id="a") - assert store.get_candidate("a") is not None - assert store.get_candidate("a").intended_at == datetime( # type: ignore[union-attr] - 2026, 9, 8, 13, 0, tzinfo=UTC - ) + candidate = store.get_candidate("a") + assert candidate is not None + assert candidate.intended_at == datetime(2026, 9, 8, 13, 0, tzinfo=UTC) def test_history_pagination_over_resolved_utc(tmp_path: Path) -> None: @@ -163,12 +162,13 @@ def test_history_pagination_over_resolved_utc(tmp_path: Path) -> None: ) page = store.list_occurrences("a", limit=2) assert page["total"] == 3 - assert page["next_cursor"] is not None - assert "|" in str(page["next_cursor"]) + next_cursor = page["next_cursor"] + assert isinstance(next_cursor, str) + assert "|" in next_cursor assert len(page["occurrences"]) == 2 # type: ignore[arg-type] second = store.list_occurrences( "a", - cursor=page["next_cursor"], + cursor=next_cursor, limit=2, # type: ignore[arg-type] ) assert second["next_cursor"] is None diff --git a/tests/wf_transport_rpc_http/test_rpc_models.py b/tests/wf_transport_rpc_http/test_rpc_models.py index 2fd8909d..9fb1afd1 100644 --- a/tests/wf_transport_rpc_http/test_rpc_models.py +++ b/tests/wf_transport_rpc_http/test_rpc_models.py @@ -1,5 +1,7 @@ from __future__ import annotations +from typing import Any, cast + import pytest from pydantic import ValidationError @@ -91,7 +93,7 @@ def test_update_schedule_params_match_create_numeric_constraints() -> None: ) with pytest.raises(ValidationError): UpdateScheduleParams( - schedule_id="schedule", expected_revision=1, max_steps="10" + schedule_id="schedule", expected_revision=1, max_steps=cast(Any, "10") ) @@ -101,11 +103,11 @@ def test_schedule_policy_params_reject_unknown_values() -> None: schedule_id="schedule", deployment_id="deployment", trigger={"kind": "oneshot", "at": "2026-09-08T12:00:00+00:00"}, - overlap="queue", + overlap=cast(Any, "queue"), ) with pytest.raises(ValidationError): UpdateScheduleParams( - schedule_id="schedule", expected_revision=1, misfire="replay" + schedule_id="schedule", expected_revision=1, misfire=cast(Any, "replay") )