mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-22 00:31:44 +00:00
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:
parent
a177e05c82
commit
167e1b20e5
1 changed files with 19 additions and 0 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue