test: tighten phase 1 coverage contracts

This commit is contained in:
huanghuoguoguo
2026-05-16 10:30:17 +08:00
parent 3ba727f0e4
commit bb55cd7ba9
44 changed files with 708 additions and 1164 deletions
+7 -6
View File
@@ -238,9 +238,9 @@ class TestResponseWrapperAssistant:
async def test_assistant_empty_content(self):
"""Assistant with empty content should not emit event."""
wrapper = get_wrapper_module()
get_entities_module()
app = FakeApp()
app.plugin_connector.emit_event = AsyncMock()
stage = wrapper.ResponseWrapper(app)
pipeline_config = make_wrapper_config()
@@ -262,8 +262,9 @@ class TestResponseWrapperAssistant:
async for result in stage.process(query, 'ResponseWrapper'):
results.append(result)
# Should have at least one result (for empty content case)
assert len(results) >= 0
assert results == []
assert query.resp_message_chain == []
app.plugin_connector.emit_event.assert_not_called()
@pytest.mark.asyncio
async def test_assistant_tool_calls(self):
@@ -313,10 +314,10 @@ class TestResponseWrapperAssistant:
async for result in stage.process(query, 'ResponseWrapper'):
results.append(result)
# Should have results for content and tool_calls
assert len(results) >= 1
assert len(results) == 2
for result in results:
assert result.result_type == entities.ResultType.CONTINUE
assert app.plugin_connector.emit_event.await_count == 2
class TestResponseWrapperInterrupt:
@@ -472,4 +473,4 @@ class TestResponseWrapperVariables:
# Check that bound_plugins was passed
emit_call = app.plugin_connector.emit_event.call_args
assert emit_call[0][1] == ['plugin1', 'plugin2'] # Second argument is bound_plugins
assert emit_call[0][1] == ['plugin1', 'plugin2'] # Second argument is bound_plugins