osint-dashboard/news/summerizer/tests/test_prompts.py
Sirius DevOps c48788d4b6
fix(map): geofence delete, vessel snapshots, sentinel cache, news briefs
Geofences could be drawn but not removed. VesselAPI Hormuz dots vanished
on restart and DVR skipped between the 5 daily polls. Sentinel-1 re-hit
STAC on every pan and often painted a neighbouring swath. Executive
briefs truncated; ticker stayed empty unless something was critical.

- Layer-panel list + polygon popup DELETE /api/geofences/{id}
- Persist VesselAPI polls to vessels (UTC-day purge, DVR as-of, boot hydrate)
- Cache Sentinel-1 by 2° cell; pick covering scene; clip Leaflet tiles
- Retry truncated LLM JSON; ticker falls back to medium/low; 3-min HUD poll
2026-08-29 20:40:27 -04:00

60 lines
1.8 KiB
Python

"""Default prompts: breaking news, ignore futures/market tape."""
from summarizer import MAP_PROMPT_DEFAULT, RECAP_PROMPT_DEFAULT, SUMMARY_PROMPT_DEFAULT
def _assert_breaking_not_futures(prompt: str) -> None:
p = prompt.lower()
assert "breaking" in p
assert "futures" in p
assert "ignore" in p or "do not" in p or "not" in p
assert "es=f" not in p
assert "yfinance" not in p
def test_map_prompt_focuses_on_breaking_news_not_futures():
_assert_breaking_not_futures(MAP_PROMPT_DEFAULT)
def test_summary_prompt_focuses_on_breaking_news_not_futures():
_assert_breaking_not_futures(SUMMARY_PROMPT_DEFAULT)
p = SUMMARY_PROMPT_DEFAULT.lower()
assert "commodity" in p or "market" in p
def test_summary_prompt_covers_critical_then_incidents():
p = SUMMARY_PROMPT_DEFAULT.lower()
assert "critical" in p
assert "crime" in p
assert "incident" in p
assert "complete" in p or "truncat" in p or "unfinished" in p or "mid-sentence" in p
def test_summary_prompt_does_not_bail_out_with_canned_empty_brief():
p = SUMMARY_PROMPT_DEFAULT
assert "AND STOP" not in p
assert "REPEAT 3 TIMES" not in p
assert "No qualifying" not in p
assert "no-qualifying" not in p.lower()
low = p.lower()
assert "always" in low
assert "recap" in low or "summar" in low
def test_recap_prompt_does_not_bail_out_with_canned_empty_brief():
p = RECAP_PROMPT_DEFAULT
assert "AND STOP" not in p
assert "No qualifying" not in p
assert "no-qualifying" not in p.lower()
low = p.lower()
assert "always" in low
assert "daily" in low
assert "24" in low
p = RECAP_PROMPT_DEFAULT.lower()
_assert_breaking_not_futures(RECAP_PROMPT_DEFAULT)
assert "daily" in p
assert "24" in p
assert "summary_en" in p
assert "ticker" in p
assert "map_items" in p