"""Golden tests for STRONG_CLOSE_SIGNAL_V1 (governance/todo/technical_signals_p4_adoption_plan.yaml P4-2).""" from __future__ import annotations import importlib.util from pathlib import Path ROOT = Path(__file__).resolve().parents[3] MODULE_PATH = ROOT / "tools" / "build_strong_close_signal_v1.py" def _load_module(): spec = importlib.util.spec_from_file_location("build_strong_close_signal_v1", MODULE_PATH) module = importlib.util.module_from_spec(spec) assert spec.loader is not None spec.loader.exec_module(module) return module def test_close_near_high_is_strong_close() -> None: mod = _load_module() result = mod.evaluate_strong_close(99, 100, 90) assert result["strong_close"] is True assert result["close_position_pct"] == 90.0 def test_close_near_low_is_not_strong_close() -> None: mod = _load_module() result = mod.evaluate_strong_close(91, 100, 90) assert result["strong_close"] is False def test_degenerate_high_equals_low_returns_null() -> None: mod = _load_module() result = mod.evaluate_strong_close(100, 100, 100) assert result["strong_close"] is None assert result["close_position_pct"] is None