test: add async path coverage for ZAI content flattening

Address Greptile feedback: the async code path in
_transform_messages was untested. Add pytest.mark.asyncio
test verifying list content is flattened in the async path.

Signed-off-by: Jay <moonandstar99@yahoo.com>
This commit is contained in:
Jay 2026-05-08 12:12:32 -04:00
parent a177e05c82
commit 167e1b20e5

View file

@ -155,3 +155,22 @@ class TestZAITransformMessages:
assert isinstance(result[0]["content"], str)
assert "caption" in result[0]["content"]
@pytest.mark.asyncio
async def test_tool_message_list_content_flattened_async(self):
"""Async path: tool message with list content is flattened."""
messages = [
{
"role": "tool",
"tool_call_id": "call_1",
"content": [{"type": "text", "text": "async result"}],
},
]
result = await self.config._transform_messages(
messages, model="glm-4.6", is_async=True
)
tool_msg = result[0]
assert isinstance(tool_msg["content"], str)
assert tool_msg["content"] == "async result"