refactor(pre-alpha): fail closed on historical preview fallbacks

This commit is contained in:
Bu5hm4nn
2026-03-26 11:55:45 +01:00
parent 4eec0127da
commit f38d0a53a9
6 changed files with 85 additions and 47 deletions

View File

@@ -32,23 +32,26 @@ def test_event_comparison_page_service_runs_seeded_gld_preset_deterministically(
)
def test_event_comparison_page_service_uses_preset_default_templates_when_none_selected() -> None:
def test_event_comparison_page_service_rejects_empty_template_selection() -> None:
service = EventComparisonPageService()
report = service.run_read_only_comparison(
preset_slug="gld-jan-2024-selloff",
template_slugs=(),
underlying_units=1000.0,
loan_amount=68000.0,
margin_call_ltv=0.75,
)
with pytest.raises(ValueError, match="Select at least one strategy template"):
service.run_read_only_comparison(
preset_slug="gld-jan-2024-selloff",
template_slugs=(),
underlying_units=1000.0,
loan_amount=68000.0,
margin_call_ltv=0.75,
)
assert [item.template_slug for item in report.rankings] == [
"protective-put-atm-12m",
"ladder-50-50-atm-95pct-12m",
"protective-put-95pct-12m",
"protective-put-90pct-12m",
]
with pytest.raises(ValueError, match="Select at least one strategy template"):
service.preview_scenario(
preset_slug="gld-jan-2024-selloff",
template_slugs=(),
underlying_units=1000.0,
loan_amount=68000.0,
margin_call_ltv=0.75,
)
def test_event_comparison_page_service_exposes_seeded_preset_options() -> None: