From 24942c2e15639fb0b86784a83996338dd5ed9e9d Mon Sep 17 00:00:00 2001 From: matdev83 <211248003+matdev83@users.noreply.github.com> Date: Thu, 9 Oct 2025 17:16:19 +0200 Subject: [PATCH] Strengthen tool call repair integration test --- tests/integration/test_json_repair_pipeline.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/integration/test_json_repair_pipeline.py b/tests/integration/test_json_repair_pipeline.py index 8b32e76d..61aa617a 100644 --- a/tests/integration/test_json_repair_pipeline.py +++ b/tests/integration/test_json_repair_pipeline.py @@ -43,12 +43,14 @@ async def stream() -> AsyncGenerator[object, None]: async for item in normalizer.process_stream(stream(), output_format="objects"): results.append(item) - # Tool call should be converted to OpenAI tool_calls JSON string within combined content - # Extract JSON substrings and check type (repaired JSON may not appear due to downstream processor behavior) + # Tool call should be converted to an OpenAI tool_calls JSON object with full metadata non_empty = [r for r in results if r.content or r.is_done] combined = "".join(r.content for r in non_empty if r.content) - # Simple presence check is adequate since tool-call content is JSON-dumped - assert '"type": "function"' in combined + tool_call = json.loads(combined) + assert tool_call["type"] == "function" + assert "id" in tool_call and tool_call["id"].startswith("call_") + assert tool_call["function"]["name"] == "myfunc" + assert json.loads(tool_call["function"]["arguments"]) == {"x": 1} @pytest.mark.asyncio