feat(v2): complete v2 reimplementation
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import UTC, datetime
|
||||
|
||||
import pytest
|
||||
from backup_tool.scheduler import ScheduleError, next_nominal
|
||||
|
||||
|
||||
def test_five_field_cron_returns_utc_nominal_time() -> None:
|
||||
result = next_nominal("0 9 * * *", "America/New_York", datetime(2026, 1, 1, tzinfo=UTC))
|
||||
assert result.tzinfo is UTC
|
||||
assert result.hour == 14
|
||||
|
||||
|
||||
@pytest.mark.parametrize(("cron", "timezone"), [("* * * * * *", "UTC"), ("* * * * *", "Nope/Zone")])
|
||||
def test_invalid_cron_or_timezone_is_rejected(cron: str, timezone: str) -> None:
|
||||
with pytest.raises(ScheduleError):
|
||||
next_nominal(cron, timezone)
|
||||
Reference in New Issue
Block a user