Files
dela e6918ffa35 feat: add superderive child and open phase-2 routing
Attach the stepwise derivation toolkit as a submodule and default
SUPERPAPER_PHASE to 2 so rewrite-figure can use superderive. Notes
still keep align for short expansions without cancel or subst.
2026-08-17 10:06:39 +08:00

43 lines
1.5 KiB
Python
Executable File

#!/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(check_row({"rewrite-figure"}, "superderive", phase=2) is None, "derive v2")
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")