Skip to content

Commit 847f671

Browse files
committed
Add MODEL_URI unit tests
1 parent ac20bf4 commit 847f671

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/test_models.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import pytest
44

5+
from embeddings.models.base import BaseEmbeddingModel
56
from embeddings.models.registry import MODEL_REGISTRY, get_model_class
67

78

@@ -46,3 +47,17 @@ def test_get_model_class_returns_correct_class():
4647
def test_get_model_class_raises_for_unknown_uri():
4748
with pytest.raises(ValueError, match="Unknown model URI"):
4849
get_model_class("unknown/model-uri")
50+
51+
52+
def test_subclass_without_model_uri_raises_type_error():
53+
with pytest.raises(TypeError, match="must define 'MODEL_URI' class attribute"):
54+
55+
class InvalidModel(BaseEmbeddingModel):
56+
pass
57+
58+
59+
def test_subclass_with_non_string_model_uri_raises_type_error():
60+
with pytest.raises(TypeError, match="must override 'MODEL_URI' with a valid string"):
61+
62+
class InvalidModel(BaseEmbeddingModel):
63+
MODEL_URI = 123

0 commit comments

Comments
 (0)