Skip to main content

Tests for Multi-Model Client (H.3.5.6).

Tests cover:

  • ModelProvider enum and model routing
  • CompletionRequest/CompletionResponse dataclasses
  • FallbackConfig configuration
  • MultiModelClient initialization and provider detection
  • Mock completion flow with retry and fallback logic
  • API key checking and available providers

File: test_multi_model_client.py

Classes

TestModelProvider

Tests for ModelProvider enum.

TestCompletionRequest

Tests for CompletionRequest dataclass.

TestCompletionResponse

Tests for CompletionResponse dataclass.

TestFallbackConfig

Tests for FallbackConfig dataclass.

TestMultiModelClientInit

Tests for MultiModelClient initialization.

TestModelProviderDetection

Tests for model-to-provider detection.

TestModelInfo

Tests for model info retrieval.

TestBackupModel

Tests for backup model lookup.

TestAPIKeyChecking

Tests for API key checking.

TestGetProviderForModel

Tests for get_provider_for_model convenience function.

Functions

test_provider_values()

Test all provider values are strings.

test_provider_count()

Test we have exactly 6 providers.

test_provider_string_enum()

Test ModelProvider is a string enum.

test_basic_request()

Test creating basic completion request.

test_request_with_options()

Test request with all options.

test_successful_response()

Test creating successful response.

test_failed_response()

Test creating failed response.

test_to_dict()

Test response serialization.

test_to_dict_truncates_long_content()

Test that to_dict truncates long content.

test_default_config()

Test default fallback configuration.

test_custom_config()

Test custom fallback configuration.

test_default_init()

Test default initialization.

test_custom_fallback_config()

Test initialization with custom fallback config.

setUp()

No description

test_anthropic_models()

Test Anthropic model detection.

Usage

python test_multi_model_client.py