Fixed lint, tests after recent fix

Updated readme
This commit is contained in:
Fahad
2025-06-14 19:31:31 +04:00
parent b41b874e31
commit f1ad06c529
5 changed files with 18 additions and 24 deletions

View File

@@ -266,7 +266,7 @@ class TestCustomProviderOpenRouterRestrictions:
@patch.dict(os.environ, {"OPENROUTER_ALLOWED_MODELS": "opus,sonnet", "OPENROUTER_API_KEY": "test-key"})
def test_custom_provider_respects_openrouter_restrictions(self):
"""Test that custom provider respects OpenRouter restrictions for cloud models."""
"""Test that custom provider correctly defers OpenRouter models to OpenRouter provider."""
# Clear any cached restriction service
import utils.model_restrictions
@@ -276,11 +276,9 @@ class TestCustomProviderOpenRouterRestrictions:
provider = CustomProvider(base_url="http://test.com/v1")
# Should validate allowed OpenRouter models (is_custom=false)
assert provider.validate_model_name("opus")
assert provider.validate_model_name("sonnet")
# Should not validate disallowed OpenRouter models
# CustomProvider should NOT validate OpenRouter models - they should be deferred to OpenRouter
assert not provider.validate_model_name("opus")
assert not provider.validate_model_name("sonnet")
assert not provider.validate_model_name("haiku")
# Should still validate custom models (is_custom=true) regardless of restrictions
@@ -288,7 +286,7 @@ class TestCustomProviderOpenRouterRestrictions:
@patch.dict(os.environ, {"OPENROUTER_ALLOWED_MODELS": "opus", "OPENROUTER_API_KEY": "test-key"})
def test_custom_provider_openrouter_capabilities_restrictions(self):
"""Test that custom provider's get_capabilities respects OpenRouter restrictions."""
"""Test that custom provider's get_capabilities correctly handles OpenRouter models."""
# Clear any cached restriction service
import utils.model_restrictions
@@ -298,7 +296,8 @@ class TestCustomProviderOpenRouterRestrictions:
provider = CustomProvider(base_url="http://test.com/v1")
# Should work for allowed OpenRouter model
# For OpenRouter models, get_capabilities should still work but mark them as OPENROUTER
# This tests the capabilities lookup, not validation
capabilities = provider.get_capabilities("opus")
assert capabilities.provider == ProviderType.OPENROUTER
@@ -335,7 +334,7 @@ class TestCustomProviderOpenRouterRestrictions:
@patch.dict(os.environ, {"OPENROUTER_ALLOWED_MODELS": "", "OPENROUTER_API_KEY": "test-key"})
def test_custom_provider_empty_restrictions_allows_all_openrouter(self):
"""Test that empty OPENROUTER_ALLOWED_MODELS allows all OpenRouter models."""
"""Test that custom provider correctly defers OpenRouter models regardless of restrictions."""
# Clear any cached restriction service
import utils.model_restrictions
@@ -345,10 +344,10 @@ class TestCustomProviderOpenRouterRestrictions:
provider = CustomProvider(base_url="http://test.com/v1")
# Should validate all OpenRouter models when restrictions are empty
assert provider.validate_model_name("opus")
assert provider.validate_model_name("sonnet")
assert provider.validate_model_name("haiku")
# CustomProvider should NOT validate OpenRouter models - they should be deferred to OpenRouter
assert not provider.validate_model_name("opus")
assert not provider.validate_model_name("sonnet")
assert not provider.validate_model_name("haiku")
class TestRegistryIntegration: