Skip to content

Commit

Permalink
[chore]: Comments Added to ignore call-args
Browse files Browse the repository at this point in the history
  • Loading branch information
keenborder786 committed Dec 20, 2024
1 parent 1572f3b commit fd3771e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libs/community/tests/unit_tests/embeddings/test_llamacpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


@pytest.fixture
def mock_llama_client():
def mock_llama_client() -> MagicMock:
with patch(
"langchain_community.embeddings.llamacpp.LlamaCppEmbeddings"
) as MockLlama:
Expand All @@ -16,15 +16,15 @@ def mock_llama_client():


def test_initialization(mock_llama_client: MagicMock) -> None:
embeddings = LlamaCppEmbeddings(client=mock_llama_client)
embeddings = LlamaCppEmbeddings(client=mock_llama_client) # type: ignore[call-arg]
assert embeddings.client is not None


def test_embed_documents(mock_llama_client: MagicMock) -> None:
mock_llama_client.create_embedding.return_value = {
"data": [{"embedding": [[0.1, 0.2, 0.3]]}, {"embedding": [[0.4, 0.5, 0.6]]}]
}
embeddings = LlamaCppEmbeddings(client=mock_llama_client)
embeddings = LlamaCppEmbeddings(client=mock_llama_client) # type: ignore[call-arg]
texts = ["Hello world", "Test document"]
result = embeddings.embed_documents(texts)
expected = [[0.1, 0.2, 0.3], [0.4, 0.5, 0.6]]
Expand All @@ -33,7 +33,7 @@ def test_embed_documents(mock_llama_client: MagicMock) -> None:

def test_embed_query(mock_llama_client: MagicMock) -> None:
mock_llama_client.embed.return_value = [[0.1, 0.2, 0.3]]
embeddings = LlamaCppEmbeddings(client=mock_llama_client)
embeddings = LlamaCppEmbeddings(client=mock_llama_client) # type: ignore[call-arg]
result = embeddings.embed_query("Sample query")
expected = [0.1, 0.2, 0.3]
assert result == expected

0 comments on commit fd3771e

Please sign in to comment.