SPB Git

spb/wp45_uqo

Public
1.9 KB · 40 lines python
1import subprocess, sys, json, re2from pathlib import Path3from typer.testing import CliRunner4from jof250.cli import app5from jof250.provenance import ROOT67def test_cli_help_lists_commands():8    r = CliRunner().invoke(app, ["--help"]); assert r.exit_code == 09    for c in ["corpus", "profiles", "index", "retrieve", "write", "review", "audit", "evidence", "benchmark", "status", "install-claude-code"]: assert c in r.output1011def test_status_runs():12    r = CliRunner().invoke(app, ["status"]); assert r.exit_code == 0 and "JoF-250 status" in r.output1314def test_claude_code_files_reference_cli():15    cdir = ROOT / ".claude"16    cmds = list((cdir / "commands").glob("jof-*.md")); agents = list((cdir / "agents").glob("jof-*.md")); skill = cdir / "skills" / "jof250" / "SKILL.md"17    assert len(cmds) == 10 and len(agents) == 7 and skill.exists()18    for p in cmds:19        t = p.read_text(); assert t.startswith("---") and "description:" in t and "/.venv/bin/jof250" in t20    for p in agents:21        t = p.read_text(); assert re.search(r"^name: jof-", t, re.M) and "model:" in t2223def test_provenance_stamp():24    from jof250.provenance import stamp, Ledger25    s = stamp(); assert s["timestamp"].endswith("+00:00") and s["code_version"]2627def test_ledger_append_only(tmp_path):28    from jof250.provenance import Ledger29    l = Ledger(tmp_path / "l.jsonl"); l.append({"a": 1}); l.append({"a": 2}); assert [r["a"] for r in l.read()] == [1, 2]3031def test_budget_cap_blocks_calls(monkeypatch):32    from jof250 import llm, config33    monkeypatch.setattr(llm, "spent_usd", lambda: 1e9)34    import pytest35    with pytest.raises(llm.BudgetExceeded): llm.call("s", "u", use_cache=False)3637def test_extract_json_tolerates_fences():38    from jof250.llm import extract_json39    assert extract_json('```json\n{"a": 1}\n```') == {"a": 1} and extract_json('text {"b": 2} more') == {"b": 2} and extract_json("no json") is None40
Files · 216d83691f0ad9cc600ca0b0c5fd81d346a2c6ad
Menu

Theme