"""Math addendum must embed ledger-derived scenario and cost numbers.""" from __future__ import annotations import sys from pathlib import Path ROOT = Path(__file__).resolve().parents[1] sys.path.insert(0, str(ROOT)) sys.path.insert(0, str(ROOT / "scripts")) from generate_math_addendum import build_tex # noqa: E402 from system_b_ledger import build_ledger # noqa: E402 def test_math_addendum_contains_ledger_numbers(): ledger = build_ledger() tex = build_tex(ledger) assert "688" in tex assert "413" in tex assert "788" in tex assert "38" in tex assert "50" in tex and "95" in tex assert "2,834" in tex or "2834" in tex assert "4,000" in tex or "4000" in tex assert "2.7" in tex and "5.4" in tex assert r"P_{\mathrm{firm}} \;\neq\; P_{\mathrm{elec}} + Q_{\mathrm{th}}" in tex assert "895" in tex # only as retired / forbidden assert "forbidden" in tex.lower() or "FORBIDDEN" in tex or "forbidden" in tex assert "180" in tex and "70" in tex and "120" in tex and "50" in tex assert r"P_{\mathrm{summer}}" in tex assert "NOT winter firm" in tex or "not winter firm" in tex.lower()