test: reconcile confidence-score output tests with #4881/#4889 (for #4888)
#4888 was built on 0.9.97, before #4881 (path weakest-hop refactor), #4889 (qualified C# method labels) and #4891 (also_seen) landed. Its cherry-pick dropped the merge commit that reconciled expectations. Update the per-hop confidence assertions to carry scores ([INFERRED 0.85]) and the C# path/explain/neighbor labels to their owner-qualified form (Exporter.Run, IReport.Build) - the correct composed output of all four features. Resolved the serve.py conflict by keeping #4881's _path_weakest/ _path_confidence_line and adding only #4888's _confidence_tag, applied over edge_evidence so parallel/also_seen evidence keeps its scores. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
13260e3927
commit
19b9e0fd6e
3 files changed
+10
-10
No files matched your search
@@ -90,7 +90,7 @@ def test_explain_prints_scores(report_graph, monkeypatch, capsys):
|
||||
out = _cli(monkeypatch, capsys, "explain", "report_ireport_build",
|
||||
"--graph", str(report_graph))
|
||||
assert out.count("[dispatches_to] [INFERRED 0.75]") == 2
|
||||
assert "<-- .Run() [calls] [INFERRED 0.85]" in out
|
||||
assert "<-- Exporter.Run() [calls] [INFERRED 0.85]" in out
|
||||
assert "[method] [EXTRACTED]" in out
|
||||
assert "[INFERRED]" not in out
|
||||
|
||||
@@ -98,20 +98,20 @@ def test_explain_prints_scores(report_graph, monkeypatch, capsys):
|
||||
def test_cli_path_prints_scores(report_graph, monkeypatch, capsys):
|
||||
out = _cli(monkeypatch, capsys, "path", "report_exporter_run",
|
||||
"report_pdfreport_build", "--graph", str(report_graph))
|
||||
assert ("--calls [INFERRED 0.85]--> .Build() "
|
||||
"--dispatches_to [INFERRED 0.75]--> .Build()") in out
|
||||
assert ("--calls [INFERRED 0.85]--> IReport.Build() "
|
||||
"--dispatches_to [INFERRED 0.75]--> PdfReport.Build()") in out
|
||||
|
||||
|
||||
def test_mcp_path_prints_scores(report_graph):
|
||||
out = _shortest_path_text(_load(report_graph), {
|
||||
"source": "report_exporter_run", "target": "report_pdfreport_build",
|
||||
})
|
||||
assert ("--calls [INFERRED 0.85]--> .Build() "
|
||||
"--dispatches_to [INFERRED 0.75]--> .Build()") in out
|
||||
assert ("--calls [INFERRED 0.85]--> IReport.Build() "
|
||||
"--dispatches_to [INFERRED 0.75]--> PdfReport.Build()") in out
|
||||
|
||||
|
||||
def test_mcp_neighbors_print_scores(report_graph):
|
||||
lines = _neighbor_lines(_load(report_graph), "report_ireport_build")
|
||||
assert sum("[dispatches_to] [INFERRED 0.75]" in ln for ln in lines) == 2
|
||||
assert any(ln.startswith(" <-- .Run() [calls] [INFERRED 0.85]") for ln in lines)
|
||||
assert any(ln.startswith(" <-- Exporter.Run() [calls] [INFERRED 0.85]") for ln in lines)
|
||||
assert any("[method] [EXTRACTED] " in ln for ln in lines)
|
||||
@@ -148,15 +148,15 @@ def test_cli_path_surfaces_weakest_tag(monkeypatch, tmp_path, capsys):
|
||||
"graphify", "path", "report_exporter_run", "report_pdfreport_build", "--graph", str(p)])
|
||||
mainmod.main()
|
||||
out = capsys.readouterr().out
|
||||
assert "--dispatches_to [AMBIGUOUS/INFERRED]-->" in out
|
||||
assert "--calls [INFERRED]-->" in out
|
||||
assert "--dispatches_to [AMBIGUOUS 0.40/INFERRED 0.75]-->" in out
|
||||
assert "--calls [INFERRED 0.85]-->" in out
|
||||
|
||||
|
||||
def test_mcp_path_surfaces_weakest_tag(tmp_path):
|
||||
_, G = _path_graph(tmp_path)
|
||||
out = _shortest_path_text(G, {"source": "report_exporter_run",
|
||||
"target": "report_pdfreport_build"})
|
||||
assert "--dispatches_to [AMBIGUOUS/INFERRED]-->" in out
|
||||
assert "--dispatches_to [AMBIGUOUS 0.40/INFERRED 0.75]-->" in out
|
||||
|
||||
|
||||
def test_report_cs_extraction_keeps_semantic_duplicate(tmp_path):
|
||||
|
||||
@@ -99,7 +99,7 @@ def test_type_member_endpoint_routes_to_the_method(monkeypatch, capsys, report_g
|
||||
code, out, err = _path(monkeypatch, capsys, report_graph, source, "PdfReport.Build")
|
||||
assert code == 0, err
|
||||
assert "Shortest path (2 hops):" in out
|
||||
assert ".Run() --calls [INFERRED]--> .Build() --dispatches_to [INFERRED]--> .Build()" in out
|
||||
assert ".Run() --calls [INFERRED 0.85]--> .Build() --dispatches_to [INFERRED 0.75]--> .Build()" in out
|
||||
assert "contains" not in out
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user