diff --git a/tests/test_serve.py b/tests/test_serve.py index bf0b4f4..3baa8d5 100644 --- a/tests/test_serve.py +++ b/tests/test_serve.py @@ -612,6 +612,19 @@ def test_load_graph_corrupted_json_prints_recovery_message(tmp_path, capsys): assert "Re-run /graphify to rebuild" in err +def test_load_graph_generic_value_error_message_unchanged(tmp_path, capsys): + """A non-decode ValueError (e.g. a non-.json path) must still print the + generic error, not the corrupted-graph hint — pins the except-clause + order from #2005 so a future refactor can't collapse them back.""" + p = tmp_path / "graph.txt" + p.write_text("not a graph") + with pytest.raises(SystemExit): + _load_graph(str(p)) + err = capsys.readouterr().err + assert "must be a .json file" in err + assert "corrupted" not in err + + def test_load_graph_rejects_oversized_file(monkeypatch, tmp_path, capsys): # #F4: oversized graph.json must fail fast (SystemExit) with a clear error. G = _make_graph()