Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jhamon committed Jul 18, 2024
1 parent afcd31b commit 1e42790
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pinecone/models/index_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def names(self):
return [i.name for i in self.indexes]

def __getitem__(self, key):
return IndexModel(self.indexes[key])
return self.indexes[key]

def __len__(self):
return len(self.indexes)
Expand Down
5 changes: 1 addition & 4 deletions tests/unit/models/test_index_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,14 @@ def test_index_list_getitem(self, index_list_response):
assert input.indexes[0].dimension == iil[0].dimension
assert input.indexes[0].metric == iil[0].metric
assert input.indexes[0].host == iil[0].host

# Deletion protection is a special case, since we're unwrapping
# the value from the DeletionProtection object inside our IndexModel
assert input.indexes[0].deletion_protection.value == iil[0].deletion_protection
assert iil[0].deletion_protection == "enabled"

assert input.indexes[1].name == iil[1].name

def test_index_list_proxies_methods(self, index_list_response):
# Forward compatibility, in case we add more attributes to IndexList for pagination
assert IndexList(index_list_response).index_list.indexes == index_list_response.indexes
assert IndexList(index_list_response).indexes[0].name == index_list_response.indexes[0].name

def test_when_results_are_empty(self):
iil = IndexList(OpenApiIndexList(indexes=[]))
Expand Down

0 comments on commit 1e42790

Please sign in to comment.