From 6cb50851185514f2d9d17ac645628e2b13a12928 Mon Sep 17 00:00:00 2001 From: gahusb Date: Sat, 16 May 2026 03:45:55 +0900 Subject: [PATCH] test(signal_v2): add scheduler boundary tests at exact transitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Code review noted missing boundary tests at: - 09:00:00 (pre-market → market) → 60 - 15:30:00 (market → post-market) → 300 - 20:00:00 (post-market → overnight skip) 3 new tests, total 8 scheduler / 14 signal_v2. Co-Authored-By: Claude Opus 4.7 (1M context) --- signal_v2/tests/test_scheduler.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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