Skip to content

Commit

Permalink
refactor import name
Browse files Browse the repository at this point in the history
  • Loading branch information
nachollorca committed Jan 20, 2025
1 parent a7f71c3 commit fc4317c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
import pytest
from agilm.types import Model
from lamine.types import Model


def test_valid_provider_no_locations():
model = Model(provider="anthropic", id="claude-3.5-sonnet-latest")
assert model.provider == "anthropic"
assert model.locations is None


def test_valid_provider_with_supported_locations():
model = Model(provider="vertex", id="gemini-1.5-flash-002", locations=["us-central1"])
assert model.provider == "vertex"
assert model.locations == ["us-central1"]


def test_valid_provider_with_multiple_supported_locations():
model = Model(provider="vertex", id="gemini-1.5-flash-002", locations=["us-central1", "eu-central1"])
assert model.provider == "vertex"
assert model.locations == ["us-central1", "eu-central1"]


def test_invalid_location_for_provider():
with pytest.raises(ValueError) as excinfo:
Model(provider="anthropic", id="claude-3.5-sonnet-latest", locations=["us-central1"])
assert str(excinfo.value) == "Provider anthropic does not support `locations`."


def test_unsupported_provider():
with pytest.raises(ValueError) as excinfo:
Model(provider="unsupported-provider", id="model-id")
assert str(excinfo.value).startswith("Provider unsupported-provider is not supported:")


def test_invalid_location_for_vertex_provider():
with pytest.raises(ValueError) as excinfo:
Model(provider="vertex", id="gemini-2-flash", locations=["invalid-location"])
Expand All @@ -38,7 +43,8 @@ def test_valid_model_id_for_vertex_provider():
assert model.provider == "vertex"
assert model.id == "gemini-1.5-pro-002"


def test_invalid_model_id_for_vertex_provider():
with pytest.raises(ValueError) as excinfo:
Model(provider="vertex", id="invalid-model-id")
assert str(excinfo.value).startswith("Provider vertex does not support model invalid-model-id:")
assert str(excinfo.value).startswith("Provider vertex does not support model invalid-model-id:")

0 comments on commit fc4317c

Please sign in to comment.