Skip to content

Commit

Permalink
leftover
Browse files Browse the repository at this point in the history
  • Loading branch information
masci committed Jan 22, 2024
1 parent 55239b9 commit 6cc5679
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions integrations/pinecone/tests/test_document_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,31 @@ def test_init_api_key_in_environment_variable(mock_pinecone, monkeypatch):
mock_pinecone.init.assert_called_with(api_key="fake-api-key", environment="gcp-starter")


@patch("haystack_integrations.document_stores.pinecone.document_store.pinecone")
def test_to_dict(mock_pinecone):
mock_pinecone.Index.return_value.describe_index_stats.return_value = {"dimension": 30}
document_store = PineconeDocumentStore(
api_key="fake-api-key",
environment="gcp-starter",
index="my_index",
namespace="test",
batch_size=50,
dimension=30,
metric="euclidean",
)
assert document_store.to_dict() == {
"type": "haystack_integrations.document_stores.pinecone.document_store.PineconeDocumentStore",
"init_parameters": {
"environment": "gcp-starter",
"index": "my_index",
"dimension": 30,
"namespace": "test",
"batch_size": 50,
"metric": "euclidean",
},
}


@pytest.mark.integration
class TestDocumentStore(CountDocumentsTest, DeleteDocumentsTest, WriteDocumentsTest):
def test_write_documents(self, document_store: PineconeDocumentStore):
Expand All @@ -72,30 +97,6 @@ def test_init_fails_wo_api_key(self, monkeypatch):
index="my_index",
)

@patch("pinecone_haystack.document_store.pinecone")
def test_to_dict(self, mock_pinecone):
mock_pinecone.Index.return_value.describe_index_stats.return_value = {"dimension": 30}
document_store = PineconeDocumentStore(
api_key="fake-api-key",
environment="gcp-starter",
index="my_index",
namespace="test",
batch_size=50,
dimension=30,
metric="euclidean",
)
assert document_store.to_dict() == {
"type": "pinecone_haystack.document_store.PineconeDocumentStore",
"init_parameters": {
"environment": "gcp-starter",
"index": "my_index",
"dimension": 30,
"namespace": "test",
"batch_size": 50,
"metric": "euclidean",
},
}

def test_embedding_retrieval(self, document_store: PineconeDocumentStore):
query_embedding = [0.1] * 768
most_similar_embedding = [0.8] * 768
Expand Down

0 comments on commit 6cc5679

Please sign in to comment.