Lee-W commented on code in PR #75847:
URL: https://github.com/apache/airflow/pull/75847#discussion_r4410785852
##########
airflow-core/tests/unit/timetables/test_cron_mixin.py:
##########
@@ -39,3 +44,209 @@ def test_dom_and_dow_conflict():
assert "(or)" in desc
assert "Every minute, on day 1 of the month" in desc
assert "Every minute, only on Monday" in desc
+
+
[email protected](
+ ("timezone", "friday_last_tick", "monday_first_tick"),
+ [
+ pytest.param(
+ "Europe/Berlin",
+ pendulum.datetime(2026, 10, 23, 21, 0, tz="UTC"), # Fri 23:00 CEST
+ pendulum.datetime(2026, 10, 25, 23, 0, tz="UTC"), # Mon 00:00 CET
+ id="berlin-fall-back",
+ ),
+ pytest.param(
+ "America/Chicago",
+ pendulum.datetime(2026, 10, 31, 4, 0, tz="UTC"), # Fri 2026-10-30
23:00 CDT
+ pendulum.datetime(2026, 11, 2, 6, 0, tz="UTC"), # Mon 00:00 CST
+ id="chicago-fall-back",
+ ),
+ pytest.param(
+ "Australia/Sydney",
+ pendulum.datetime(2026, 4, 3, 12, 0, tz="UTC"), # Fri 23:00 AEDT
+ pendulum.datetime(2026, 4, 5, 14, 0, tz="UTC"), # Mon 00:00 AEST
+ id="sydney-fall-back",
+ ),
+ pytest.param(
+ "Europe/Berlin",
+ pendulum.datetime(2027, 3, 26, 22, 0, tz="UTC"), # Fri 23:00 CET
+ pendulum.datetime(2027, 3, 28, 22, 0, tz="UTC"), # Mon 00:00 CEST
+ id="berlin-spring-forward",
+ ),
+ ],
+)
+def test_weekday_hourly_across_weekend_dst(
+ timezone: str, friday_last_tick: pendulum.DateTime, monday_first_tick:
pendulum.DateTime
+):
+ mixin = CronMixin("0 * * * 1-5", timezone)
+
+ assert mixin._get_next(friday_last_tick) == monday_first_tick
+ assert mixin._get_prev(monday_first_tick) == friday_last_tick
+
+
[email protected](
+ ("timezone", "cron", "current", "expected"),
+ [
+ pytest.param(
+ "America/Havana",
+ "0 * * * 0",
+ pendulum.datetime(2026, 10, 26, 3, 0, tz="UTC"),
+ # Sun 00:00 -04:00, first of the folded hour
+ pendulum.datetime(2026, 11, 1, 4, 0, tz="UTC"),
+ id="havana-target-in-fold-hour",
+ ),
+ pytest.param(
+ "Europe/Berlin",
+ "0 * * * *",
+ pendulum.datetime(2026, 10, 25, 0, 0, tz="UTC"),
+ pendulum.datetime(2026, 10, 25, 1, 0, tz="UTC"),
+ id="berlin-fold-first-step",
+ ),
+ pytest.param(
+ "Europe/Berlin",
+ "0 * * * *",
+ pendulum.datetime(2026, 10, 25, 1, 0, tz="UTC"),
+ pendulum.datetime(2026, 10, 25, 2, 0, tz="UTC"),
+ id="berlin-fold-second-step",
+ ),
+ pytest.param(
+ "America/Havana",
+ "0 * * * 0",
+ pendulum.datetime(2027, 3, 13, 4, 0, tz="UTC"),
+ # Sun 00:00 is skipped by the spring-forward gap, so the next tick
is the following hour
+ pendulum.datetime(2027, 3, 14, 5, 0, tz="UTC"),
+ id="havana-next-target-in-gap",
+ ),
+ pytest.param(
+ "America/Godthab",
+ "0 * * * 6",
+ pendulum.datetime(2026, 10, 25, 0, 0, tz="UTC"),
+ # Sat 23:00 -02:00 is followed by its fold twin Sat 23:00 -03:00
+ pendulum.datetime(2026, 10, 25, 1, 0, tz="UTC"),
+ id="godthab-next-fold-twin",
+ ),
+ pytest.param(
+ "America/Santiago",
+ "0 * * * 6",
+ pendulum.datetime(2026, 4, 5, 2, 0, tz="UTC"),
+ # Sat 23:00 -03:00 is followed by its fold twin Sat 23:00 -04:00
+ pendulum.datetime(2026, 4, 5, 3, 0, tz="UTC"),
+ id="santiago-next-fold-twin",
+ ),
+ pytest.param(
+ "America/Godthab",
+ "0,30 * * * 6",
+ pendulum.datetime(2026, 10, 25, 0, 30, tz="UTC"),
+ # Sat 23:00 -02:00 (second pass of the fold hour) comes before the
twin Sat 23:30 -02:00
+ pendulum.datetime(2026, 10, 25, 1, 0, tz="UTC"),
+ id="godthab-next-half-hour-fold",
+ ),
+ ],
+)
+def test_get_next_across_dst(
Review Comment:
Added Lord_Howe in both directions and Troll, plus two Havana sparse-cron
fold cases that pin the ambiguity check.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]