Skip to content

Commit

Permalink
feat: Add error handling to test in case model2vec not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhinav KM committed Dec 4, 2024
1 parent f178784 commit 581a1db
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions libs/community/tests/unit_tests/embeddings/test_model2vec.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from langchain_community.embeddings.model2vec import Model2vecEmbeddings


def test_hugginggface_inferenceapi_embedding_documents_init() -> None:
"""Test model2vec embeddings."""
try:
embedding = Model2vecEmbeddings()
assert len(embedding.embed_query("hi")) == 256
except Exception as e:

Check failure on line 9 in libs/community/tests/unit_tests/embeddings/test_model2vec.py

View workflow job for this annotation

GitHub Actions / cd libs/community / make lint #3.13

Ruff (F841)

tests/unit_tests/embeddings/test_model2vec.py:9:25: F841 Local variable `e` is assigned to but never used

Check failure on line 9 in libs/community/tests/unit_tests/embeddings/test_model2vec.py

View workflow job for this annotation

GitHub Actions / cd libs/community / make lint #3.9

Ruff (F841)

tests/unit_tests/embeddings/test_model2vec.py:9:25: F841 Local variable `e` is assigned to but never used
# model2vec is not installed
assert True

0 comments on commit 581a1db

Please sign in to comment.