fix(tests): align expected Responses wire bodies with string input normalization

Update shell-tool fixtures to expect list input on the wire and fold
string-input coverage into an existing aresponses mock test to avoid
new TQ008 budget violations.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
SrivalliKoppanapudiQZ 2026-09-20 00:06:12 +05:30
parent c30fb24c46
commit cd3a758f2b
3 changed files with 13 additions and 49 deletions

View file

@ -1,6 +1,11 @@
{
"model": "gpt-5-mini",
"input": "List files in /mnt/data and run python --version.",
"input": [
{
"role": "user",
"content": "List files in /mnt/data and run python --version."
}
],
"tools": [
{
"type": "shell",

View file

@ -1,6 +1,11 @@
{
"model": "gpt-4o",
"input": "List files in /mnt/data and run python --version.",
"input": [
{
"role": "user",
"content": "List files in /mnt/data and run python --version."
}
],
"context_management": [
{
"type": "compaction",

View file

@ -219,53 +219,7 @@ async def test_aresponses_drops_stream_options():
post_kwargs = mock_post.call_args.kwargs
request_body = post_kwargs["json"] if "json" in post_kwargs else json.loads(post_kwargs["data"])
assert "stream_options" not in request_body
@pytest.mark.asyncio
async def test_aresponses_normalizes_string_input_to_user_list():
with patch(
"litellm.llms.custom_httpx.http_handler.AsyncHTTPHandler.post",
new_callable=AsyncMock,
) as mock_post:
mock_post.return_value = MockResponse(
_minimal_responses_api_payload("resp_string_input", "gpt-5.5"), 200
)
await litellm.aresponses(
model="openai/gpt-5.5",
api_key="fake-api-key",
input="Reply with exactly ROUTE_OK.",
max_output_tokens=64,
)
mock_post.assert_called_once()
post_kwargs = mock_post.call_args.kwargs
request_body = post_kwargs["json"] if "json" in post_kwargs else json.loads(post_kwargs["data"])
assert request_body["input"] == [{"role": "user", "content": "Reply with exactly ROUTE_OK."}]
@pytest.mark.asyncio
async def test_aresponses_forwards_list_input_unchanged():
list_input = [{"role": "user", "content": "Reply with exactly ROUTE_OK."}]
with patch(
"litellm.llms.custom_httpx.http_handler.AsyncHTTPHandler.post",
new_callable=AsyncMock,
) as mock_post:
mock_post.return_value = MockResponse(
_minimal_responses_api_payload("resp_list_input", "gpt-5.5"), 200
)
await litellm.aresponses(
model="openai/gpt-5.5",
api_key="fake-api-key",
input=list_input,
max_output_tokens=64,
)
mock_post.assert_called_once()
post_kwargs = mock_post.call_args.kwargs
request_body = post_kwargs["json"] if "json" in post_kwargs else json.loads(post_kwargs["data"])
assert request_body["input"] == list_input
assert request_body["input"] == [{"role": "user", "content": "hi"}]
@pytest.mark.asyncio