fix(tests): Correct unreachable assertion in truncation test (#23425)

Signed-off-by: AzizCode92 <azizbenothman76@gmail.com>
This commit is contained in:
Aziz 2025-08-23 07:23:54 +02:00 committed by GitHub
parent b4e9fd811f
commit d9a55204ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -74,18 +74,15 @@ async def test_bigger_truncation_size(client: openai.AsyncOpenAI):
} }
with pytest.raises(openai.BadRequestError) as err: with pytest.raises(openai.BadRequestError) as err:
err = await client.post(path="embeddings", await client.post(path="embeddings", cast_to=object, body={**kwargs})
cast_to=object,
body={**kwargs})
assert str(err) == f"""openai.BadRequestError: assert err.value.status_code == 400
Error code: 400 - {{'object': 'error', error_details = err.value.response.json()["error"]
'message': 'truncate_prompt_tokens value assert error_details["type"] == "BadRequestError"
({truncation_size}) expected_message = ("truncate_prompt_tokens value is "
is greater than max_model_len ({max_model_len}). "greater than max_model_len."
Please, select a smaller truncation size.', " Please, select a smaller truncation size.")
'type': 'BadRequestError', assert error_details["message"] == expected_message
'param': None, 'code': 400}}"""
@pytest.mark.asyncio @pytest.mark.asyncio