from datetime import datetime, timezone from ntr_fetcher.week import get_show_week def test_mid_week_thursday(): """Thursday should belong to the show that started the previous Wednesday.""" # 2025-03-13 is Thursday (2026-03-13 is Friday) now = datetime(2025, 3, 13, 15, 0, 0, tzinfo=timezone.utc) start, end = get_show_week(now, show_day=2, show_hour=22) assert start == datetime(2025, 3, 13, 2, 0, 0, tzinfo=timezone.utc) assert end == datetime(2025, 3, 20, 2, 0, 0, tzinfo=timezone.utc) def test_wednesday_before_show(): """Wednesday before 22:00 ET belongs to the previous week's show.""" # 2025-03-12 is Wednesday now = datetime(2025, 3, 12, 20, 0, 0, tzinfo=timezone.utc) start, end = get_show_week(now, show_day=2, show_hour=22) assert start == datetime(2025, 3, 6, 3, 0, 0, tzinfo=timezone.utc) assert end == datetime(2025, 3, 13, 2, 0, 0, tzinfo=timezone.utc) def test_wednesday_after_show_starts(): """Wednesday at or after 22:00 ET belongs to the new week.""" # 2025-03-13 02:30 UTC = Wed 2025-03-12 22:30 ET now = datetime(2025, 3, 13, 2, 30, 0, tzinfo=timezone.utc) start, end = get_show_week(now, show_day=2, show_hour=22) assert start == datetime(2025, 3, 13, 2, 0, 0, tzinfo=timezone.utc) assert end == datetime(2025, 3, 20, 2, 0, 0, tzinfo=timezone.utc) def test_est_period_no_dst(): """January — firmly in EST (UTC-5).""" now = datetime(2026, 1, 15, 12, 0, 0, tzinfo=timezone.utc) start, end = get_show_week(now, show_day=2, show_hour=22) assert start == datetime(2026, 1, 15, 3, 0, 0, tzinfo=timezone.utc) assert end == datetime(2026, 1, 22, 3, 0, 0, tzinfo=timezone.utc)