TriuneCadence/tests/test_experiments.py

29 lines
828 B
Python

import csv
from pathlib import Path
from composer_ans.experiments import run_parameter_sweep
THES = Path(__file__).resolve().parents[1] / "THES"
def test_run_parameter_sweep_writes_reports_and_summary(tmp_path: Path) -> None:
reports = run_parameter_sweep(
thes_root=THES,
output_dir=tmp_path,
notes=2,
parameter_sets=[
{"object_threshold": 2, "art_vigilance": 0.85},
{"object_threshold": 3, "art_vigilance": 0.9},
],
)
assert len(reports) == 2
assert (tmp_path / "run_001.json").exists()
assert (tmp_path / "run_002.json").exists()
assert (tmp_path / "summary.csv").exists()
with (tmp_path / "summary.csv").open("r", encoding="utf-8", newline="") as handle:
rows = list(csv.DictReader(handle))
assert len(rows) == 2