diff --git a/tests/unit/llms/anthropic/test_anthropic_common_utils.py b/tests/unit/llms/anthropic/test_anthropic_common_utils.py index aa0aebaa9c9..3feb730b2e1 100644 --- a/tests/unit/llms/anthropic/test_anthropic_common_utils.py +++ b/tests/unit/llms/anthropic/test_anthropic_common_utils.py @@ -4692,6 +4692,18 @@ def test_requires_native_compaction_beta_is_false_without_a_signal( assert requires_native_compaction_beta(provider, optional_params, messages) is False +def test_merge_header_sources_keeps_only_the_string_betas_of_a_mixed_list() -> None: + merged: Final = merge_header_sources( + {"anthropic-beta": ["context-1m-2025-08-07", b"bytes-beta", ("nested",), object(), 3]}, + {"Anthropic-Beta": "message-threads-2026-08-12", "x-other": "kept"}, + ) + + assert dict(merged) == { + "anthropic-beta": "context-1m-2025-08-07,message-threads-2026-08-12", + "x-other": "kept", + } + + @pytest.mark.parametrize( ("custom_llm_provider", "model", "expected"), [ @@ -4733,15 +4745,3 @@ def test_tools_without_strict_drops_only_the_strict_key_and_counts_the_strict_to assert tools_without_strict(tools) == ToolsWithoutStrict( tools=({"name": "a"}, {"name": "b"}, {"name": "c"}), dropped_count=1 ) - - -def test_merge_header_sources_keeps_only_the_string_betas_of_a_mixed_list() -> None: - merged: Final = merge_header_sources( - {"anthropic-beta": ["context-1m-2025-08-07", b"bytes-beta", ("nested",), object(), 3]}, - {"Anthropic-Beta": "message-threads-2026-08-12", "x-other": "kept"}, - ) - - assert dict(merged) == { - "anthropic-beta": "context-1m-2025-08-07,message-threads-2026-08-12", - "x-other": "kept", - }