diff --git a/signal_v2/tests/test_scheduler.py b/signal_v2/tests/test_scheduler.py index e04e3dd..4f7ff0a 100644 --- a/signal_v2/tests/test_scheduler.py +++ b/signal_v2/tests/test_scheduler.py @@ -39,3 +39,23 @@ def test_next_interval_holiday_skip(): interval = _next_interval(now) # Next: 2026-05-06 (Wed) 07:00, ~21h away assert 20 * 3600 < interval < 22 * 3600 + + +def test_next_interval_at_market_open_boundary(): + """09:00:00 정확 second → 60초 (market 구간 진입).""" + now = _kst(2026, 5, 18, 9, 0) # Monday 09:00:00 + assert _next_interval(now) == 60 + + +def test_next_interval_at_market_close_boundary(): + """15:30:00 정확 second → 300초 (post-market 구간 진입).""" + now = _kst(2026, 5, 18, 15, 30) # Monday 15:30:00 + assert _next_interval(now) == 300 + + +def test_next_interval_at_polling_window_end_boundary(): + """20:00:00 정확 second → overnight skip (다음 영업일 07:00 까지).""" + now = _kst(2026, 5, 18, 20, 0) # Monday 20:00:00 + interval = _next_interval(now) + # Next: Tuesday 07:00 — 11h away + assert 11 * 3600 - 60 < interval < 11 * 3600 + 60