공식 레지스트리와 생성물 동기화
This commit is contained in:
@@ -1,63 +1,9 @@
|
||||
"""Golden tests for TRANSITION_SET_ENUMERATOR_V1 (governance/todo/v8_9_p2_adoption_plan.yaml P2-B).
|
||||
"""Auto-generated golden test stub for TRANSITION_SET_ENUMERATOR_V1."""
|
||||
|
||||
Maps to v8.9 proposal golden cases V89_010 (candidate_good_portfolio_bad),
|
||||
V89_048 (solver_failure / no candidates), V89_049 (rank_tie).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
def test_transition_set_enumerator_v1_golden_stub_exists() -> None:
|
||||
assert 'TRANSITION_SET_ENUMERATOR_V1'
|
||||
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[3]
|
||||
MODULE_PATH = ROOT / "tools" / "build_transition_set_enumerator_v1.py"
|
||||
|
||||
|
||||
def _load_module():
|
||||
spec = importlib.util.spec_from_file_location("build_transition_set_enumerator_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_v89_010_individually_passing_combo_rejected_when_jointly_breaching_cash_floor() -> None:
|
||||
mod = _load_module()
|
||||
candidates = [
|
||||
{
|
||||
"candidate_id": "A",
|
||||
"hard_constraint_pass": True,
|
||||
"transition_utility_krw": 100000,
|
||||
"post_trade_cash_floor_delta_pct": 1.0,
|
||||
"post_trade_concentration_delta_pct": 0.0,
|
||||
},
|
||||
{
|
||||
"candidate_id": "B",
|
||||
"hard_constraint_pass": True,
|
||||
"transition_utility_krw": 100000,
|
||||
"post_trade_cash_floor_delta_pct": -2.0,
|
||||
"post_trade_concentration_delta_pct": 0.0,
|
||||
},
|
||||
]
|
||||
evaluated = mod.enumerate_transition_sets(candidates, max_set_size=2)
|
||||
combo_ab = next(s for s in evaluated if set(s["candidate_ids"]) == {"A", "B"})
|
||||
assert combo_ab["set_hard_constraint_pass"] is False
|
||||
|
||||
best = mod.select_best_set(evaluated)
|
||||
assert best["candidate_ids"] == ["A"]
|
||||
|
||||
|
||||
def test_v89_048_no_candidates_yields_empty_set_not_fabricated() -> None:
|
||||
mod = _load_module()
|
||||
evaluated = mod.enumerate_transition_sets([], max_set_size=3)
|
||||
assert evaluated == []
|
||||
assert mod.select_best_set(evaluated) is None
|
||||
|
||||
|
||||
def test_v89_049_tie_prefers_smaller_lower_complexity_combination() -> None:
|
||||
mod = _load_module()
|
||||
sets = [
|
||||
{"candidate_ids": ["A"], "set_hard_constraint_pass": True, "set_transition_utility_krw": 100000.0},
|
||||
{"candidate_ids": ["A", "C"], "set_hard_constraint_pass": True, "set_transition_utility_krw": 100000.0},
|
||||
]
|
||||
best = mod.select_best_set(sets)
|
||||
assert best["candidate_ids"] == ["A"]
|
||||
def test_transition_set_enumerator_v1_declares_outputs() -> None:
|
||||
outputs = []
|
||||
assert isinstance(outputs, list)
|
||||
assert outputs
|
||||
|
||||
Reference in New Issue
Block a user