Summarizer still runs the 15-min analyst, plus a 24h breaking-news recap at 23:00 America/New_York. HUD pins kind=daily_recap. Prompts ignore futures/market tape.
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
"""Wall-clock scheduling: 15-min analyst + 23:00 America/New_York recap."""
|
|
|
|
from datetime import datetime, timedelta
|
|
from zoneinfo import ZoneInfo
|
|
|
|
from run_news_summarizer import next_event, next_recap_datetime
|
|
|
|
TZ = ZoneInfo("America/New_York")
|
|
|
|
|
|
def test_next_recap_is_11pm_same_day_before_2300():
|
|
now = datetime(2026, 8, 28, 15, 4, tzinfo=TZ)
|
|
got = next_recap_datetime(now)
|
|
assert got == datetime(2026, 8, 28, 23, 0, tzinfo=TZ)
|
|
|
|
|
|
def test_next_recap_is_11pm_next_day_at_or_after_2300():
|
|
now = datetime(2026, 8, 28, 23, 0, tzinfo=TZ)
|
|
got = next_recap_datetime(now)
|
|
assert got == datetime(2026, 8, 29, 23, 0, tzinfo=TZ)
|
|
|
|
|
|
def test_next_recap_honors_custom_hour():
|
|
now = datetime(2026, 8, 28, 10, 0, tzinfo=TZ)
|
|
got = next_recap_datetime(now, hour=22, minute=30)
|
|
assert got == datetime(2026, 8, 28, 22, 30, tzinfo=TZ)
|
|
|
|
|
|
def test_next_event_picks_recap_when_sooner_than_interval():
|
|
now = datetime(2026, 8, 28, 22, 50, tzinfo=TZ)
|
|
last_periodic = now - timedelta(seconds=100)
|
|
when, kind = next_event(now, last_periodic=last_periodic, interval_s=900)
|
|
assert kind == "recap"
|
|
assert when == datetime(2026, 8, 28, 23, 0, tzinfo=TZ)
|
|
|
|
|
|
def test_next_event_picks_interval_when_recap_is_hours_away():
|
|
now = datetime(2026, 8, 28, 10, 0, tzinfo=TZ)
|
|
last_periodic = now
|
|
when, kind = next_event(now, last_periodic=last_periodic, interval_s=900)
|
|
assert kind == "interval"
|
|
assert when == now + timedelta(seconds=900)
|