Skip to content

Commit

Permalink
chroma[patch]: (nit) simplify test (#28517)
Browse files Browse the repository at this point in the history
Use `self.get_embeddings` on test class instead of importing embeddings
separately.
  • Loading branch information
ccurme authored Dec 4, 2024
1 parent a013014 commit 8bc2c91
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions libs/partners/chroma/tests/integration_tests/test_standard.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import AsyncGenerator, Generator

import pytest
from langchain_core.embeddings.fake import DeterministicFakeEmbedding
from langchain_core.vectorstores import VectorStore
from langchain_tests.integration_tests.vectorstores import (
AsyncReadWriteTestSuite,
Expand All @@ -15,8 +14,7 @@ class TestSync(ReadWriteTestSuite):
@pytest.fixture()
def vectorstore(self) -> Generator[VectorStore, None, None]: # type: ignore
"""Get an empty vectorstore for unit tests."""
embeddings = DeterministicFakeEmbedding(size=10)
store = Chroma(embedding_function=embeddings)
store = Chroma(embedding_function=self.get_embeddings())
try:
yield store
finally:
Expand All @@ -28,8 +26,7 @@ class TestAsync(AsyncReadWriteTestSuite):
@pytest.fixture()
async def vectorstore(self) -> AsyncGenerator[VectorStore, None]: # type: ignore
"""Get an empty vectorstore for unit tests."""
embeddings = DeterministicFakeEmbedding(size=10)
store = Chroma(embedding_function=embeddings)
store = Chroma(embedding_function=self.get_embeddings())
try:
yield store
finally:
Expand Down

0 comments on commit 8bc2c91

Please sign in to comment.