Orchestrata Ultimate › Tests › Reference › providers › adapters

Tests reference — tests/providers/adapters

tests/providers/adapters — 9 test modules, 83 test functions. Source tree: tests/providers/adapters at commit 8a2cb42ad. Generated from the tests AST snapshot by scripts/gen-data-pages.py.

Prose pending.

Modules

Module Tests Covers
conftest.py 0 0
test_anthropic_adapter.py 22 2
test_base_adapter.py 8 2
test_claude_cli_adapter.py 23 2
test_deepseek_adapter.py 7 2
test_ollama_adapter.py 6 2
test_openai_adapter.py 8 2
test_openrouter_adapter.py 9 2

Module details

tests/providers/adapters/conftest.py

source · 0 tests · 84 lines

Shared fixtures for tests/providers/adapters/.

tests/providers/adapters/test_anthropic_adapter.py

source · 22 tests · 713 lines

Tests for providers.adapters.anthropic_adapter.

Covers: providers.adapters.anthropic_adapter, core.protocols/ (package)

Kind Name Line Description
class TestAnthropicAdapterHeaders 91
method TestAnthropicAdapterHeaders.test_get_headers 92
class TestAnthropicAdapterModels 101
method TestAnthropicAdapterModels.test_get_models_empty 102
method TestAnthropicAdapterModels.test_get_models_with_pricing 107
class TestAnthropicAdapterCapabilities 118
method TestAnthropicAdapterCapabilities.test_supports_capability_when_present 119
method TestAnthropicAdapterCapabilities.test_supports_capability_when_absent 125
method TestAnthropicAdapterCapabilities.test_supports_capability_no_pricing 131
class TestAnthropicAdapterCompleteRequestBuilding 137
method TestAnthropicAdapterCompleteRequestBuilding.test_system_messages_merged_and_generation_params_forwarded 138 System messages are pulled out and joined; temperature/top_p/top_k/
method TestAnthropicAdapterCompleteRequestBuilding.test_no_system_message_omits_system_key_and_defaults_max_tokens 190 With no system message, 'system' is absent from the payload and
class TestAnthropicAdapterCompleteResponseParsing 227
method TestAnthropicAdapterCompleteResponseParsing.test_tool_use_blocks_are_parsed_into_tool_calls 228 A tool_use content block must surface as an OpenAI-compatible entry
method TestAnthropicAdapterCompleteResponseParsing.test_missing_content_and_usage_default_safely 274 A response with no 'content'/'usage' keys must not raise, and must
class TestAnthropicAdapterToolForwarding 299 SPEC-011/103 backlog #33: request.tools/tool_choice must reach the
method TestAnthropicAdapterToolForwarding.test_tools_translated_to_anthropic_schema 304 OpenAI-shaped {type:function, function:{name,description,parameters}}
method TestAnthropicAdapterToolForwarding.test_tool_choice_auto_mapped 354
method TestAnthropicAdapterToolForwarding.test_tool_choice_required_mapped_to_any 373 Anthropic has no "required" tool_choice; "any" forces tool use.
method TestAnthropicAdapterToolForwarding.test_tool_choice_named_function_mapped_to_tool 393 The OpenAI dict form {type:function, function:{name}} forces one
method TestAnthropicAdapterToolForwarding.test_tool_choice_none_omits_tools_entirely 420 Anthropic has no "none": when the caller asks not to use tools, the
method TestAnthropicAdapterToolForwarding.test_no_tools_request_is_unchanged 444 A request with no tools/tool_choice in parameters must not gain a
class TestAnthropicAdapterMultiTurnToolRoundTrip 468 SPEC-011/103 backlog #33: assistant tool_calls / tool-role messages
method TestAnthropicAdapterMultiTurnToolRoundTrip.test_assistant_tool_calls_become_tool_use_block 472
method TestAnthropicAdapterMultiTurnToolRoundTrip.test_assistant_text_and_tool_calls_produce_text_then_tool_use 538 When the assistant turn has both text and a tool call, the text
method TestAnthropicAdapterMultiTurnToolRoundTrip.test_parallel_tool_results_merge_into_one_user_turn 581 Two tool-role messages answering a single multi-tool assistant turn
method TestAnthropicAdapterMultiTurnToolRoundTrip.test_malformed_tool_call_arguments_default_to_empty_input 637 Unparseable/missing arguments JSON must not raise — it degrades
class TestAnthropicAdapterCompleteErrorMapping 677
method TestAnthropicAdapterCompleteErrorMapping.test_authentication_error_status_raises_http_status_error 678 A 401 from Anthropic (e.g. bad x-api-key) must surface as
method TestAnthropicAdapterCompleteErrorMapping.test_rate_limit_error_status_raises_http_status_error 698 A 429 from Anthropic must also surface as httpx.HTTPStatusError.

tests/providers/adapters/test_base_adapter.py

source · 8 tests · 82 lines

Tests for providers.adapters.base.

Covers: providers.adapters.base, core.interfaces/ (package)

Kind Name Line Description
class TestBaseAdapter 27
method TestBaseAdapter.test_init 28
method TestBaseAdapter.test_get_headers_default 34
method TestBaseAdapter.test_build_pricing_empty 39
method TestBaseAdapter.test_build_pricing_with_data 44
method TestBaseAdapter.test_close_no_client 52
method TestBaseAdapter.test_ensure_client_creates_client 58
method TestBaseAdapter.test_ensure_client_reuses_client 66
method TestBaseAdapter.test_ensure_client_recreate_after_close 74

tests/providers/adapters/test_claude_cli_adapter.py

source · 23 tests · 358 lines

Tests for providers.adapters.claude_cli_adapter.

Covers: providers.adapters.claude_cli_adapter, core.protocols/ (package)

Kind Name Line Description
class TestFindClaude 35
method TestFindClaude.test_returns_string 36
method TestFindClaude.test_fallback_loop_when_not_on_path 40 PATH emptied so shutil.which("claude") misses, and HOME points
method TestFindClaude.test_fallback_finds_home_local_bin 59 When PATH search misses but a real file exists at the first
class TestBuildPrompt 73
method TestBuildPrompt.test_system_and_user_combined 74 A system message plus a user message must be flattened into
method TestBuildPrompt.test_user_only_no_system 87
class TestMapModel 95
method TestMapModel.test_sonnet_alias 96
method TestMapModel.test_sonnet_full_name 99
method TestMapModel.test_opus_alias 102
method TestMapModel.test_opus_full_name 105
method TestMapModel.test_unknown_model_passthrough 108
class TestClaudeCLIAdapter 112
method TestClaudeCLIAdapter.test_init 113
method TestClaudeCLIAdapter.test_build_pricing 118
method TestClaudeCLIAdapter.test_close 122
method TestClaudeCLIAdapter.test_complete_minimal 126 complete drives the real subprocess/stdin/parse path end-to-end.
method TestClaudeCLIAdapter.test_complete_sandboxes_subprocess 163 Regression test for the unsupervised-mutation defect: complete
method TestClaudeCLIAdapter.test_complete_no_binary_raises 203 complete raises RuntimeError when the CLI binary is missing.
method TestClaudeCLIAdapter.test_complete_times_out 216 A real subprocess that sleeps past a near-zero timeout override
class TestBuildResponse 250 Direct unit tests of _build_response -- a pure post-processing
method TestBuildResponse.test_success_returns_raw_response 256
method TestBuildResponse.test_subprocess_env_drops_the_anthropic_key 270 The CLI subprocess must never inherit ANTHROPIC_API_KEY.
method TestBuildResponse.test_subprocess_env_without_the_key_is_unchanged 294 An environment that never had the key passes through intact.
method TestBuildResponse.test_nonzero_returncode_with_content_raises 299 A non-zero exit is a FAILURE even when stdout carries text.
method TestBuildResponse.test_nonzero_returncode_error_names_both_streams 326 The raised message must carry stdout AND stderr.
method TestBuildResponse.test_nonzero_returncode_no_content_raises 346 A non-zero exit code with empty stdout has nothing usable to

tests/providers/adapters/test_deepseek_adapter.py

source · 7 tests · 197 lines

Tests for providers.adapters.deepseek_adapter.

Covers: providers.adapters.deepseek_adapter, core.protocols/ (package)

Kind Name Line Description
class TestDeepSeekAdapterToolChoiceNone 79 SPEC-011/103 F12 (dogfood run-3e): DeepSeek v4 was observed ignoring
method TestDeepSeekAdapterToolChoiceNone.test_tool_choice_none_omits_tools_and_tool_choice 87
method TestDeepSeekAdapterToolChoiceNone.test_tool_choice_auto_keeps_tools_and_tool_choice 109
method TestDeepSeekAdapterToolChoiceNone.test_no_tool_choice_at_all_is_unaffected 131 A request with no tool_choice key at all must pass tools
class TestDeepSeekAdapter 154
method TestDeepSeekAdapter.test_get_headers 155
method TestDeepSeekAdapter.test_get_models 162
method TestDeepSeekAdapter.test_supports_capability 172
method TestDeepSeekAdapter.test_complete_invalid_key_raises 179 complete raises HTTPStatusError with invalid credentials.

tests/providers/adapters/test_ollama_adapter.py

source · 6 tests · 76 lines

Tests for providers.adapters.ollama_adapter.

Covers: providers.adapters.ollama_adapter, core.protocols/ (package)

Kind Name Line Description
class TestOllamaAdapter 34
method TestOllamaAdapter.test_get_headers 35
method TestOllamaAdapter.test_get_models_empty 40
method TestOllamaAdapter.test_get_models_with_pricing 45
method TestOllamaAdapter.test_supports_capability_true 57
method TestOllamaAdapter.test_supports_capability_false 63
method TestOllamaAdapter.test_complete_no_server_raises 68 complete raises ConnectError when Ollama is not running.

tests/providers/adapters/test_openai_adapter.py

source · 8 tests · 202 lines

Tests for providers.adapters.openai_adapter.

Covers: providers.adapters.openai_adapter, core.protocols/ (package)

Kind Name Line Description
class TestOpenAIAdapterToolChoiceNone 79 SPEC-011/103 F12 (dogfood run-3e): OpenAI-compatible adapters must
method TestOpenAIAdapterToolChoiceNone.test_tool_choice_none_omits_tools_and_tool_choice 86
method TestOpenAIAdapterToolChoiceNone.test_tool_choice_auto_keeps_tools_and_tool_choice 108
method TestOpenAIAdapterToolChoiceNone.test_no_tool_choice_at_all_is_unaffected 130 A request with no tool_choice key at all (tools not in use, or the
class TestOpenAIAdapter 154
method TestOpenAIAdapter.test_get_headers 155
method TestOpenAIAdapter.test_get_models_empty 162
method TestOpenAIAdapter.test_get_models_with_pricing 167
method TestOpenAIAdapter.test_supports_capability 178
method TestOpenAIAdapter.test_complete_invalid_key_raises 186 complete raises HTTPStatusError with invalid credentials.

tests/providers/adapters/test_openrouter_adapter.py

source · 9 tests · 286 lines

Tests for providers.adapters.openrouter_adapter.

Covers: providers.adapters.openrouter_adapter, core.protocols/ (package)

Kind Name Line Description
class TestOpenRouterAdapterToolChoiceNone 79 SPEC-011/103 F12 (dogfood run-3e): OpenRouter builds its request the
method TestOpenRouterAdapterToolChoiceNone.test_tool_choice_none_omits_tools_and_tool_choice 87
method TestOpenRouterAdapterToolChoiceNone.test_tool_choice_auto_keeps_tools_and_tool_choice 111
method TestOpenRouterAdapterToolChoiceNone.test_no_tool_choice_at_all_is_unaffected 135 A request with no tool_choice key at all must pass tools
class TestOpenRouterAdapter 160
method TestOpenRouterAdapter.test_get_headers 161
method TestOpenRouterAdapter.test_get_models 172
method TestOpenRouterAdapter.test_supports_capability 180
method TestOpenRouterAdapter.test_complete_invalid_key_raises 188 complete raises HTTPStatusError with invalid credentials.
class TestOpenRouterToolCallsRoundTrip 207 Regression (2026-07-13, first openrouter-cheap pipeline run): this
method TestOpenRouterToolCallsRoundTrip.test_response_tool_calls_are_surfaced 215
method TestOpenRouterToolCallsRoundTrip.test_request_preserves_tool_protocol_message_fields 248

Support files

Fixtures, package markers and helpers without test functions.