test(history): add single history id acceptance test for multiple mode

- Add test case to verify multiple-mode history lookup accepts a single history_id string
- Create FakeVectorStore stub with minimal implementation for ReadHistory tests
- Return requested history node from vector store mock
- Initialize ReadHistory tool with multiple mode enabled
- Add pylint disable comment for protected access to vector store property
This commit is contained in:
方应 2026-04-28 14:12:36 +08:00
parent a618c5c3ca
commit 6af3f7df96

View file

@ -139,8 +139,13 @@ async def test_summarize_memory_raises_runtime_error_for_unstructured_result(mon
@pytest.mark.asyncio
async def test_read_history_accepts_single_history_id_in_multiple_mode():
"""Verify multiple-mode history lookup accepts a single history_id string."""
class FakeVectorStore:
"""Minimal vector store stub for ReadHistory tests."""
async def get(self, vector_ids):
"""Return the requested history node."""
assert vector_ids == ["history_123"]
node = MemoryNode(
memory_id="history_123",
@ -151,7 +156,7 @@ async def test_read_history_accepts_single_history_id_in_multiple_mode():
return [node.to_vector_node()]
tool = ReadHistory(enable_multiple=True)
tool._vector_store = FakeVectorStore()
tool._vector_store = FakeVectorStore() # pylint: disable=protected-access
tool.context = RuntimeContext(
history_id="history_123",
retrieved_nodes=[],