from scripts.quant.aggregate import build_row from scripts.quant.plot import pareto_points, render_all def test_pareto_points_skips_failed_and_missing(): rows = [ build_row(method="bf16", status="ok", mean_latency_s=6.0, mean_cer=0.0, t4_deployable=True), build_row(method="awq", status="ok", mean_latency_s=4.0, mean_cer=0.01, t4_deployable=True), build_row(method="gptq", status="failed", t4_deployable=True), build_row(method="fp8", status="ok", mean_latency_s=3.0, mean_cer=0.02, t4_deployable=False), ] points = pareto_points(rows, x_key="mean_latency_s", y_key="mean_cer") methods = {p["method"] for p in points} assert methods == {"bf16", "awq", "fp8"} # gptq failed -> skipped awq = next(p for p in points if p["method"] == "awq") assert awq["x"] == 4.0 and awq["y"] == 0.01 and awq["t4_deployable"] is True def test_render_all_writes_png_files(tmp_path): rows = [ build_row(method="bf16", status="ok", mean_latency_s=6.0, mean_cer=0.0, mean_bbox_iou=1.0, t4_deployable=True), build_row(method="awq", status="ok", mean_latency_s=4.0, mean_cer=0.01, mean_bbox_iou=0.98, t4_deployable=True), ] written = render_all(rows, tmp_path) assert all(p.exists() for p in written) assert any(p.name == "pareto_latency_cer.png" for p in written)