test: localize calendar recurrence helper import (#4944)

* test: localize calendar recurrence helper import

* test: share calendar route import helper
This commit is contained in:
Alexandre Teixeira
2026-06-28 18:04:15 +01:00
committed by GitHub
parent 927b1f7ecf
commit bad9ec2f9c
6 changed files with 47 additions and 49 deletions
+4 -4
View File
@@ -13,7 +13,7 @@ The fallback now normalizes to UTC and strips tz, exactly like the ISO path.
"""
import pytest
from tests.test_null_owner_gates import _import_calendar_helpers
from tests.helpers.calendar_routes import import_calendar_routes
# Inputs datetime.fromisoformat() rejects (so they hit the dateutil fallback)
# but that carry a numeric UTC offset dateutil resolves to tz-aware.
@@ -25,7 +25,7 @@ _OFFSET_NONISO = [
@pytest.mark.parametrize("s", _OFFSET_NONISO)
def test_parse_dt_dateutil_fallback_returns_naive(s):
cal = _import_calendar_helpers()
cal = import_calendar_routes()
d = cal._parse_dt(s)
assert d.tzinfo is None, f"{s!r} leaked tz-aware: {d!r}"
# +0900 14:00 -> 05:00 UTC, naive.
@@ -34,13 +34,13 @@ def test_parse_dt_dateutil_fallback_returns_naive(s):
@pytest.mark.parametrize("s", _OFFSET_NONISO)
def test_parse_dt_pair_fallback_returns_naive(s):
cal = _import_calendar_helpers()
cal = import_calendar_routes()
dt, _is_utc = cal._parse_dt_pair(s)
assert dt.tzinfo is None, f"{s!r} leaked tz-aware via _parse_dt_pair: {dt!r}"
def test_parse_dt_naive_input_unchanged():
cal = _import_calendar_helpers()
cal = import_calendar_routes()
d = cal._parse_dt("January 5, 2026 14:00") # no offset -> stays as parsed
assert d.tzinfo is None
assert (d.hour, d.minute) == (14, 0)