Hypergraph is more powerful. Transform unstructured text into structured knowledge with LLMs. Graphs, hypergraphs, and spatio-temporal extractions — with one command.
test: MCP search/ask return build-index hint for list and model KAs
dex0shubhame0259a8efb7d
diff --git a/tests/test_mcp_server.py b/tests/test_mcp_server.pyindex 661b272..bab5477 100644--- a/tests/test_mcp_server.py+++ b/tests/test_mcp_server.py@@ -11,7 +11,7 @@ import pytestfrom pydantic import BaseModel, Fieldfrom hyperextract import mcp_server-from hyperextract.types import AutoGraph+from hyperextract.types import AutoGraph, AutoList, AutoModelfrom tests.mocks import MockChatModel, MockEmbeddings@@ -227,6 +227,33 @@ def test_search_without_index_is_handled(monkeypatch):assert "build-index" in out[email protected]("kind", ["list", "model"])+def test_search_and_ask_without_index_is_handled_for_list_and_model(+ monkeypatch, kind+):+ """AutoList/AutoModel must surface the same build-index hint as graphs."""++ class Item(BaseModel):+ name: str++ if kind == "list":+ ka = AutoList(+ item_schema=Item, llm_client=MockChatModel(), embedder=MockEmbeddings()+ )+ ka.append(Item(name="Apple"))+ else:+ ka = AutoModel(+ data_schema=Item, llm_client=MockChatModel(), embedder=MockEmbeddings()+ )+ ka._data = Item(name="Apple")+ monkeypatch.setattr(mcp_server, "_load_ka", lambda p: ka)++ out = mcp_server.search("x", "anything")+ assert "Cannot search" in out and "build-index" in out+ out = mcp_server.ask("x", "anything")+ assert "Cannot answer" in out and "build-index" in out++class _StubKA:"""Stub KA to test the MCP tool wiring independently of chat/export internals(those are covered by their own modules; this isolates the MCP layer)."""