fix: update ProactiveStep tests for string-based answer format

The proactive step answer was changed from dict to string in the
previous commit. These tests now verify:
- answer is a string (not dict)
- answer contains expected text patterns (summary, topics, content)
- metadata still carries structured data for programmatic consumers

Refs #379
This commit is contained in:
RerankerGuo 2026-07-28 22:58:39 +08:00
parent 6145c568d3
commit acd379d655

View file

@ -221,20 +221,12 @@ def test_proactive_answer_includes_topics_and_requested_content(tmp_path):
)
assert response.success is True
assert response.answer == {
"summary": "Read 1 proactive topic(s) from daily/2026-05-28/interests.yaml",
"topics": [
{
"title": "Retrieval quality",
"reason": "Search behavior changed repeatedly.",
"evidence": "daily/2026-05-28/session.md",
"keywords": [],
"paths": [],
},
],
"content": content,
}
assert response.metadata["topics"] == response.answer["topics"]
assert isinstance(response.answer, str)
assert "Read 1 proactive topic(s) from daily/2026-05-28/interests.yaml" in response.answer
assert "Topics:" in response.answer
assert "Retrieval quality" in response.answer
assert "Content:" in response.answer
assert response.metadata["topics"][0]["title"] == "Retrieval quality"
assert response.metadata["content"] == content
asyncio.run(run())
@ -255,8 +247,10 @@ def test_proactive_answer_omits_unrequested_content(tmp_path):
)
assert response.success is True
assert "content" not in response.answer
assert response.answer["topics"][0]["title"] == "Topic"
assert isinstance(response.answer, str)
assert "Content:" not in response.answer
assert "Topics:" in response.answer
assert "Topic" in response.answer
assert response.metadata["content"] == ""
asyncio.run(run())