chore: clean up scheduling review diagnostics

This commit is contained in:
lda
2026-09-09 22:19:50 +07:00 Verified
parent 80b26bff4e
commit 8d0c61737f
2 changed files with 12 additions and 10 deletions
+7 -7
View File
@@ -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(first, schedule_id="a")
store.save_candidate(second, schedule_id="a") store.save_candidate(second, schedule_id="a")
assert store.get_candidate("a") is not None candidate = store.get_candidate("a")
assert store.get_candidate("a").intended_at == datetime( # type: ignore[union-attr] assert candidate is not None
2026, 9, 8, 13, 0, tzinfo=UTC assert candidate.intended_at == datetime(2026, 9, 8, 13, 0, tzinfo=UTC)
)
def test_history_pagination_over_resolved_utc(tmp_path: Path) -> None: 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) page = store.list_occurrences("a", limit=2)
assert page["total"] == 3 assert page["total"] == 3
assert page["next_cursor"] is not None next_cursor = page["next_cursor"]
assert "|" in str(page["next_cursor"]) assert isinstance(next_cursor, str)
assert "|" in next_cursor
assert len(page["occurrences"]) == 2 # type: ignore[arg-type] assert len(page["occurrences"]) == 2 # type: ignore[arg-type]
second = store.list_occurrences( second = store.list_occurrences(
"a", "a",
cursor=page["next_cursor"], cursor=next_cursor,
limit=2, # type: ignore[arg-type] limit=2, # type: ignore[arg-type]
) )
assert second["next_cursor"] is None assert second["next_cursor"] is None
@@ -1,5 +1,7 @@
from __future__ import annotations from __future__ import annotations
from typing import Any, cast
import pytest import pytest
from pydantic import ValidationError from pydantic import ValidationError
@@ -91,7 +93,7 @@ def test_update_schedule_params_match_create_numeric_constraints() -> None:
) )
with pytest.raises(ValidationError): with pytest.raises(ValidationError):
UpdateScheduleParams( 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", schedule_id="schedule",
deployment_id="deployment", deployment_id="deployment",
trigger={"kind": "oneshot", "at": "2026-09-08T12:00:00+00:00"}, trigger={"kind": "oneshot", "at": "2026-09-08T12:00:00+00:00"},
overlap="queue", overlap=cast(Any, "queue"),
) )
with pytest.raises(ValidationError): with pytest.raises(ValidationError):
UpdateScheduleParams( UpdateScheduleParams(
schedule_id="schedule", expected_revision=1, misfire="replay" schedule_id="schedule", expected_revision=1, misfire=cast(Any, "replay")
) )