45 lines
1.5 KiB
Python
45 lines
1.5 KiB
Python
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
SRC_DIR = ROOT / "src"
|
|
if str(SRC_DIR) not in sys.path:
|
|
sys.path.insert(0, str(SRC_DIR))
|
|
|
|
import renunney.track1_api as api
|
|
|
|
|
|
def test_run_config_report_mode_writes_report_bundle(tmp_path: Path):
|
|
report_dir = tmp_path / "report"
|
|
config = api.Track1RunConfig(
|
|
mode="report",
|
|
K=5000,
|
|
N0=20,
|
|
n=1,
|
|
u=5e-6,
|
|
R=10.0,
|
|
T=20,
|
|
runs=2,
|
|
seed=1,
|
|
report_dir=str(report_dir),
|
|
)
|
|
payload = api.run_config(config)
|
|
assert payload["mode"] == "report"
|
|
report_path = Path(payload["report_path"])
|
|
assert report_path.exists()
|
|
report_text = report_path.read_text(encoding="utf-8")
|
|
assert "- `K`: `5000`" in report_text
|
|
assert "- `u`: `5e-06`" in report_text
|
|
assert "- `M`: `0.05`" in report_text
|
|
assert "Extinction Occurred" in report_text
|
|
assert "First Extinction t" in report_text
|
|
assert (report_dir / "aggregate_series.json").exists()
|
|
assert (report_dir / "tracking_summary.json").exists()
|
|
assert (report_dir / "figure_fecundity.png").exists()
|
|
assert (report_dir / "figure_fitness.png").exists()
|
|
assert (report_dir / "figure_expected_productivity.png").exists()
|
|
assert (report_dir / "figure_realized_M.png").exists()
|
|
assert (report_dir / "figure_survival_fraction.png").exists()
|
|
assert (report_dir / "figure_fecundity_excess.png").exists()
|
|
assert (report_dir / "figure_mean_allele_vs_target.png").exists()
|