test(integration): address round-6 review — clearer skip & assert message
- test_no_results_for_unrelated_query: use pytest.skip when the nonsense query returns nothing (the ideal outcome) so the report shows the path was taken, instead of a bare return appearing as a silent pass. - _top_score: include result.content in the isError assertion message for faster failure diagnosis. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
829625f2a2
commit
4c7c627e51
@@ -411,7 +411,7 @@ async def _top_score(nc_mcp_client: Any, query: str) -> float | None:
|
|||||||
"nc_semantic_search",
|
"nc_semantic_search",
|
||||||
arguments={"query": query, "limit": 5, "score_threshold": 0.0},
|
arguments={"query": query, "limit": 5, "score_threshold": 0.0},
|
||||||
)
|
)
|
||||||
assert result.isError is False
|
assert result.isError is False, result.content
|
||||||
data = json.loads(result.content[0].text)
|
data = json.loads(result.content[0].text)
|
||||||
results = data.get("results", [])
|
results = data.get("results", [])
|
||||||
if not results: # guard the list directly, not via total_found
|
if not results: # guard the list directly, not via total_found
|
||||||
@@ -436,7 +436,9 @@ async def test_no_results_for_unrelated_query(nc_mcp_client, indexed_manual_pdf)
|
|||||||
nc_mcp_client, "quantum entanglement hadron collider particle physics"
|
nc_mcp_client, "quantum entanglement hadron collider particle physics"
|
||||||
)
|
)
|
||||||
if unrelated is None:
|
if unrelated is None:
|
||||||
return # No results for nonsense query — the ideal outcome.
|
# No results for the nonsense query is the ideal outcome; skip (rather
|
||||||
|
# than a silent pass) so the test report shows the path was taken.
|
||||||
|
pytest.skip("No results for nonsense physics query — the ideal outcome")
|
||||||
|
|
||||||
relevant = await _top_score(
|
relevant = await _top_score(
|
||||||
nc_mcp_client, "how do I enable two-factor authentication"
|
nc_mcp_client, "how do I enable two-factor authentication"
|
||||||
|
|||||||
Reference in New Issue
Block a user