Kpenciler's picture
Upload 53 files
88435ed verified
import pytest
from neollm.llm.platform import Platform
class TestPlatform:
def test_str(self) -> None:
assert Platform.AZURE == "azure" # type: ignore
assert Platform.OPENAI == "openai" # type: ignore
assert Platform.ANTHROPIC == "anthropic" # type: ignore
assert Platform.GCP == "gcp" # type: ignore
def test_init(self) -> None:
assert Platform("azure") == Platform.AZURE
assert Platform("openai") == Platform.OPENAI
assert Platform("anthropic") == Platform.ANTHROPIC
assert Platform("gcp") == Platform.GCP
assert Platform("Azure ") == Platform.AZURE
assert Platform(" OpenAI") == Platform.OPENAI
assert Platform("Anthropic ") == Platform.ANTHROPIC
assert Platform("GcP") == Platform.GCP
def test_from_string(self) -> None:
assert Platform.from_string("azure") == Platform.AZURE
assert Platform.from_string("openai") == Platform.OPENAI
assert Platform.from_string("anthropic") == Platform.ANTHROPIC
assert Platform.from_string("gcp") == Platform.GCP
def test_from_string_error(self) -> None:
with pytest.raises(ValueError):
Platform.from_string("error")