#!/usr/bin/env python3 import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "scripts")) from router import accepted, check_row, suggest def expect(cond, msg): if not cond: raise SystemExit(f"FAIL: {msg}") expect(suggest({"loss-curve"}) == "numeric", "loss-curve class") expect(accepted("numeric") == frozenset({"screenshot", "matplotlib"}), "numeric accepted") expect(suggest({"table"}) == "raster", "table class") expect("matplotlib" not in accepted("raster"), "raster rejects matplotlib") expect(suggest({"axis", "architecture"}) == "SPLIT:tensor+fig", "split order") expect( check_row({"axis", "architecture"}, "superfig") == "SP011", "mixed row", ) expect(check_row({"rewrite-figure"}, "align", phase=1) is None, "align ok") expect(check_row({"rewrite-figure"}, "superderive", phase=1) == "SP010", "derive v1") expect(suggest(set()) == "none", "empty") expect(suggest({"notation"}) == "none", "notation") expect(check_row(set(), "none", status="included") == "SP013", "none included") expect( check_row({"rewrite-figure"}, "align", include="figures/F1/build/F1.pdf") == "SP014", "align include", ) expect( check_row({"architecture"}, "superfig", status="included", include=None) == "SP015", "vector null include", ) expect( check_row({"table"}, "screenshot", status="included", include="nope.png", fig_id="F2") == "SP016", "screenshot path", ) print("router_test ok")