Skip to content

Commit f4ef72c

Browse files
committed
test: do not assume the first ask-query hit carries jsondata
- SMW ask results have no defined order and Category:Item can hold pages without a jsondata slot - scan all returned titles, require at least one with the slot
1 parent 4b7dd7e commit f4ef72c

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

‎tests/integration/test_mcp_server.py‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,21 @@ def test_search_schema_and_read(mcp_tools):
6161
category_schema = mcp_tools["get_category_schema"](category="Category:Item")
6262
assert "exists" in category_schema
6363

64-
if found["titles"]:
65-
title = found["titles"][0]
66-
entity = mcp_tools["get_entity"](title=title)
67-
assert entity["title"] == title
68-
assert entity["exists"] is True
69-
70-
page_slots = mcp_tools["list_page_slots"](title=title)
71-
assert page_slots["exists"] is True
72-
assert any(s["key"] == "jsondata" for s in page_slots["slots"])
64+
# An ask query has no defined result order and a category can hold pages
65+
# without a jsondata slot, so check every hit rather than trusting the first.
66+
titles = found["titles"]
67+
if titles:
68+
with_jsondata = []
69+
for title in titles:
70+
entity = mcp_tools["get_entity"](title=title)
71+
assert entity["title"] == title
72+
assert entity["exists"] is True
73+
74+
page_slots = mcp_tools["list_page_slots"](title=title)
75+
assert page_slots["exists"] is True
76+
if any(s["key"] == "jsondata" for s in page_slots["slots"]):
77+
with_jsondata.append(title)
78+
assert with_jsondata, f"no jsondata slot on any of {titles}"
7379

7480

7581
def test_delete_guard_blocks_untracked(mcp_tools):

0 commit comments

Comments
 (0)