test(convert_dict_to_response): expect the type-naming error for a null choices value

This commit is contained in:
mateo-berri 2026-09-09 15:56:41 -07:00
parent cbeac27656
commit 21e6c6e2f3

View file

@ -1645,7 +1645,7 @@ class TestMissingChoicesGuard:
assert result.usage.prompt_tokens == 10
def test_convert_to_model_response_object_null_choices_raises_api_error(self):
"""choices=None raises APIError."""
"""choices=None raises APIError that names the type instead of claiming the key is missing."""
from litellm.exceptions import APIError
response_object = {
@ -1661,7 +1661,7 @@ class TestMissingChoicesGuard:
model_response_object=ModelResponse(),
)
assert "no 'choices'" in exc_info.value.message
assert "'choices' that is not a list (NoneType)" in exc_info.value.message
def test_convert_to_streaming_response_no_choices_raises_api_error(self):
"""Missing choices in streaming cache-hit path raises APIError."""