Skip to content

Commit 2439a17

Browse files
committed
test: add test_dst_hourly
Add a DST test for a hourly schedule.
1 parent f28c4a8 commit 2439a17

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/croniter/tests/test_croniter.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,22 @@ def test_std_dst3(self):
893893
dt2 = tz.localize(datetime(2020, 4, 24))
894894
self.assertEqual(val2, dt2)
895895

896+
def test_dst_hourly(self) -> None:
897+
"""
898+
DST test for hourly schedule
899+
900+
Test fixing https://github.com/pallets-eco/croniter/issues/149
901+
902+
Europe/London jumps 1 hour forward on 2025-03-30 01:00
903+
"""
904+
london = dateutil.tz.gettz("Europe/London")
905+
start = datetime(2025, 3, 30, tzinfo=london)
906+
ct = croniter("7 * * * *", start)
907+
schedule = [ct.get_next(datetime).isoformat() for _ in range(3)]
908+
self.assertEqual(
909+
schedule, ["2025-03-30T00:07:00+00:00", "2025-03-30T02:07:00+01:00", "2025-03-30T03:07:00+01:00"]
910+
)
911+
896912
def test_dst_daily(self) -> None:
897913
"""
898914
DST test for daily schedule

0 commit comments

Comments
 (0)