From cf881cbc7b8f090c6d10ace0efcc1ecf0ac4246f Mon Sep 17 00:00:00 2001 From: bunnysayzz Date: Thu, 1 Oct 2026 10:14:05 +0530 Subject: [PATCH] test: assert the chunk predicate rejects extra keys Covers the upper bound of the two-sided predicate in the same test that guards the lower bound, per review on #43499. --- tests/unit/litellm_core_utils/test_streaming_handler.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/litellm_core_utils/test_streaming_handler.py b/tests/unit/litellm_core_utils/test_streaming_handler.py index 3e872b9f070..56e3a4ab2d9 100644 --- a/tests/unit/litellm_core_utils/test_streaming_handler.py +++ b/tests/unit/litellm_core_utils/test_streaming_handler.py @@ -4999,6 +4999,7 @@ def test_generic_chunk_predicate_rejects_partial_chunk(): "index": 0, } assert generic_chunk_has_all_required_fields(full_chunk) is True + assert generic_chunk_has_all_required_fields({**full_chunk, "unknown_extra_key": "value"}) is False stream = convert_generic_chunk_to_model_response_stream(full_chunk) assert stream.choices[0].delta.content == "hello"