feat(phase-9): implement layout variations, pareto fleet optimization, and final demonstration
This commit is contained in:
@@ -34,6 +34,15 @@ def running_server(tmp_path: Path):
|
||||
(exp_dir / "congestion_heatmap.svg").write_text("<svg><circle r='10'/></svg>", encoding="utf-8")
|
||||
(exp_dir / "report.md").write_text("# Test Report\nContent", encoding="utf-8")
|
||||
|
||||
# Create mock optimization in tmp_path
|
||||
opt_dir = tmp_path / "optimization"
|
||||
opt_dir.mkdir(parents=True)
|
||||
(opt_dir / "optimization_summary.json").write_text(json.dumps({
|
||||
"evaluation": {"overall_score": 85.0},
|
||||
"layout_comparison": [{"variant": "baseline", "is_best": False}],
|
||||
}), encoding="utf-8")
|
||||
(opt_dir / "layout_comparison.svg").write_text("<svg><rect width='100' height='100'/></svg>", encoding="utf-8")
|
||||
|
||||
port = find_free_port()
|
||||
server = DashboardServer(results_dir=tmp_path, host="127.0.0.1", port=port)
|
||||
|
||||
@@ -97,7 +106,21 @@ def test_server_health_and_api_endpoints(running_server):
|
||||
assert "fleet_sizing" in comps
|
||||
assert "dispatch_policies" in comps
|
||||
|
||||
# 7. Static HTML page
|
||||
# 7. Optimization endpoint
|
||||
with urllib.request.urlopen(f"{base_url}/api/optimization", timeout=3.0) as resp:
|
||||
assert resp.status == 200
|
||||
opt_data = json.loads(resp.read().decode("utf-8"))
|
||||
assert "evaluation" in opt_data
|
||||
assert "layout_comparison" in opt_data
|
||||
|
||||
# 8. Optimization comparison SVG endpoint
|
||||
with urllib.request.urlopen(f"{base_url}/api/optimization/comparison.svg", timeout=3.0) as resp:
|
||||
assert resp.status == 200
|
||||
assert "image/svg+xml" in resp.headers.get("Content-Type", "")
|
||||
opt_svg = resp.read().decode("utf-8")
|
||||
assert "<svg" in opt_svg
|
||||
|
||||
# 9. Static HTML page
|
||||
with urllib.request.urlopen(f"{base_url}/", timeout=3.0) as resp:
|
||||
assert resp.status == 200
|
||||
html = resp.read().decode("utf-8")
|
||||
|
||||
Reference in New Issue
Block a user