Add S/R v2 research and validation harness
This commit is contained in:
@@ -730,6 +730,23 @@ def test_window_setups_too_short_returns_empty():
|
||||
assert bt._window_setups([], {}, {}) == []
|
||||
|
||||
|
||||
def test_sr_research_variant_is_explicit_and_validated(monkeypatch):
|
||||
monkeypatch.setenv("BACKTEST_SR_VARIANT", "production_control")
|
||||
assert bt._sr_research_variant() == "production_control"
|
||||
monkeypatch.setenv("BACKTEST_SR_VARIANT", "not-a-variant")
|
||||
with pytest.raises(ValueError, match="Unknown BACKTEST_SR_VARIANT"):
|
||||
bt._sr_research_variant()
|
||||
|
||||
|
||||
def test_backtest_entry_bounds_validate_dates(monkeypatch):
|
||||
monkeypatch.setenv("BACKTEST_ENTRY_START", "2024-07-01")
|
||||
monkeypatch.setenv("BACKTEST_ENTRY_END", "2024-12-31")
|
||||
assert bt._backtest_entry_bounds() == (date(2024, 7, 1), date(2024, 12, 31))
|
||||
monkeypatch.setenv("BACKTEST_ENTRY_START", "2025-01-01")
|
||||
with pytest.raises(ValueError, match="on or before"):
|
||||
bt._backtest_entry_bounds()
|
||||
|
||||
|
||||
def test_replay_ticker_candidates_carry_gate_fields():
|
||||
"""The ablation recomputes floors from candidate fields — a candidate missing
|
||||
action/risk_level silently zeroes the ablation rows (July 2026 regression)."""
|
||||
|
||||
Reference in New Issue
Block a user