40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
from __future__ import annotations
|
|
|
|
import json
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
def test_validate_dotnet_parity_contract_passes() -> None:
|
|
root = Path(__file__).resolve().parents[2]
|
|
proc = subprocess.run(
|
|
[sys.executable, str(root / "tools" / "validate_dotnet_parity_contract_v1.py")],
|
|
cwd=root,
|
|
capture_output=True,
|
|
text=True,
|
|
)
|
|
assert proc.returncode == 0, proc.stdout + proc.stderr
|
|
payload = json.loads(proc.stdout)
|
|
assert payload["gate"] == "PASS"
|
|
assert payload["formula_id"] == "WBS_10_DOTNET_PARITY_CONTRACT_V1"
|
|
|
|
|
|
def test_validate_dotnet_parity_contract_reports_missing_target() -> None:
|
|
root = Path(__file__).resolve().parents[2]
|
|
temp = root / "Temp" / "test_wbs_10_parity_contract_bad.yaml"
|
|
temp.write_text(
|
|
"formula_id: WBS_10_DOTNET_PARITY_CONTRACT_V1\ngoal: Python reference와 .NET domain 결과를 데이터 기반 parity 계약으로 고정한다.\ntargets: []\n",
|
|
encoding="utf-8",
|
|
)
|
|
proc = subprocess.run(
|
|
[sys.executable, str(root / "tools" / "validate_dotnet_parity_contract_v1.py"), "--contract", str(temp)],
|
|
cwd=root,
|
|
capture_output=True,
|
|
text=True,
|
|
)
|
|
assert proc.returncode != 0
|
|
payload = json.loads(proc.stdout)
|
|
assert payload["gate"] == "FAIL"
|
|
assert "formula_engine_timing missing" in payload["missing"]
|