Skip to content

Commit

Permalink
add unit tests for manage module
Browse files Browse the repository at this point in the history
  • Loading branch information
austin-denoble committed Oct 13, 2023
1 parent 6c031f0 commit 6a0f7c5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/unit/test_grpc_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def setup_method(self):
sparse_values=SparseValues(indices=self.sparse_indices_2, values=self.sparse_values_2))


# region: upsert tests
# region: upsert tests

def _assert_called_once(self, vectors, async_call=False):
self.index._wrap_grpc_call.assert_called_once_with(
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def setup_method(self):
pinecone.init(api_key='example-key')
self.index = pinecone.Index('example-name')

# region: upsert tests

def test_upsert_numpy_deprecation_warning(self, mocker):
mocker.patch.object(self.index._vector_api, 'upsert', autospec=True)
with pytest.warns(FutureWarning):
Expand Down
15 changes: 15 additions & 0 deletions tests/unit/test_manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import pytest
import pinecone

class TestManage:

def test_get_api_instance_without_host(self):
pinecone.init(api_key="123-456-789", environment="my-environment")
api_instance = pinecone.manage._get_api_instance()
assert api_instance.api_client.configuration.host == "https://controller.my-environment.pinecone.io"

def test_get_api_instance_with_host(self):
pinecone.init(api_key="123-456-789", environment="my-environment", host="my-host")
api_instance = pinecone.manage._get_api_instance()
assert api_instance.api_client.configuration.host == "my-host"

0 comments on commit 6a0f7c5

Please sign in to comment.