mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-24 00:52:24 +00:00
test: migrate phase 12 legacy llm provider tests to tests/unit
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
4852d71606
commit
ef6237b9f2
21 changed files with 15 additions and 22 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
from typing import Final
|
||||
|
||||
import litellm
|
||||
import pytest
|
||||
from pytest_socket import enable_socket, socket_allow_hosts
|
||||
|
||||
|
|
@ -9,6 +10,19 @@ os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True"
|
|||
LOOPBACK_HOSTS: Final = ["127.0.0.1", "::1"]
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def local_model_cost_map(monkeypatch):
|
||||
original_model_cost = litellm.model_cost
|
||||
monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")
|
||||
litellm.model_cost = litellm.get_model_cost_map(url="")
|
||||
litellm.get_model_info.cache_clear()
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
litellm.model_cost = original_model_cost
|
||||
litellm.get_model_info.cache_clear()
|
||||
|
||||
|
||||
def _allow_loopback_only() -> None:
|
||||
socket_allow_hosts(LOOPBACK_HOSTS, allow_unix_socket=True)
|
||||
|
||||
|
|
|
|||
|
|
@ -55,10 +55,6 @@ def _search_kwargs(**overrides):
|
|||
|
||||
|
||||
class TestS3VectorsVectorStoreConfig:
|
||||
def test_init(self):
|
||||
config = S3VectorsVectorStoreConfig()
|
||||
assert config is not None
|
||||
|
||||
def test_get_supported_openai_params(self):
|
||||
config = S3VectorsVectorStoreConfig()
|
||||
params = config.get_supported_openai_params("test-model")
|
||||
|
|
@ -10,10 +10,7 @@ from unittest.mock import MagicMock
|
|||
import httpx
|
||||
import pytest
|
||||
|
||||
from litellm.llms.stability.image_generation import (
|
||||
StabilityImageGenerationConfig,
|
||||
get_stability_image_generation_config,
|
||||
)
|
||||
from litellm.llms.stability.image_generation import StabilityImageGenerationConfig
|
||||
from litellm.types.llms.stability import (
|
||||
OPENAI_SIZE_TO_STABILITY_ASPECT_RATIO,
|
||||
STABILITY_GENERATION_MODELS,
|
||||
|
|
@ -266,20 +263,6 @@ class TestStabilityImageGenerationConfig:
|
|||
assert "filtered" in str(exc_info.value).lower()
|
||||
|
||||
|
||||
class TestFactoryFunction:
|
||||
"""Test the factory function"""
|
||||
|
||||
def test_get_stability_image_generation_config(self):
|
||||
"""Test that factory returns correct config type"""
|
||||
config = get_stability_image_generation_config("stability/sd3")
|
||||
assert isinstance(config, StabilityImageGenerationConfig)
|
||||
|
||||
def test_factory_returns_config_for_any_model(self):
|
||||
"""Test that factory works for any model name"""
|
||||
config = get_stability_image_generation_config("stability/custom-model")
|
||||
assert isinstance(config, StabilityImageGenerationConfig)
|
||||
|
||||
|
||||
class TestOpenAISizeMapping:
|
||||
"""Test the size to aspect ratio mapping"""
|
||||
|
||||
Loading…
Add table
Reference in a new issue