Skip to content

Commit

Permalink
update vector policy and vector query tests (#37647)
Browse files Browse the repository at this point in the history
  • Loading branch information
simorenoh authored Sep 30, 2024
1 parent b7fe65c commit a88c145
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def test_ordering_distances(self):
"SimilarityScore FROM c ORDER BY VectorDistance(c.embedding, [{}], false, {{'distanceFunction': 'euclidean'}})" \
.format(str(i), vector_string, vector_string)

flat_list = list(self.created_flat_euclidean_container.query_items(query=specs_query,
flat_list = list(self.created_flat_euclidean_container.query_items(query=vanilla_query,
enable_cross_partition_query=True))
verify_ordering(flat_list, "euclidean")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ async def test_ordering_distances_async(self):
"SimilarityScore FROM c ORDER BY VectorDistance(c.embedding, [{}], false, {{'distanceFunction': 'euclidean'}})" \
.format(str(i), vector_string, vector_string)

flat_list = [item async for item in self.created_flat_euclidean_container.query_items(query=specs_query)]
flat_list = [item async for item in self.created_flat_euclidean_container.query_items(query=vanilla_query)]
verify_ordering(flat_list, "euclidean")

quantized_list = [item async for item in self.created_quantized_cosine_container.query_items(query=specs_query)]
Expand Down
3 changes: 2 additions & 1 deletion sdk/cosmos/azure-cosmos/test/test_vector_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ def test_fail_replace_vector_indexing_policy(self):
pytest.fail("Container replace should have failed for indexing policy.")
except exceptions.CosmosHttpResponseError as e:
assert e.status_code == 400
assert "Vector Indexing Policy cannot be changed in Collection Replace" in e.http_error_message
assert "Paths in existing vector indexing policy cannot be modified in Collection Replace." \
" They can only be added or removed." in e.http_error_message
self.test_db.delete_container(container_id)

def test_fail_create_vector_embedding_policy(self):
Expand Down
3 changes: 2 additions & 1 deletion sdk/cosmos/azure-cosmos/test/test_vector_policy_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ async def test_fail_replace_vector_indexing_policy_async(self):
pytest.fail("Container replace should have failed for indexing policy.")
except exceptions.CosmosHttpResponseError as e:
assert e.status_code == 400
assert "Vector Indexing Policy cannot be changed in Collection Replace" in e.http_error_message
assert "Paths in existing vector indexing policy cannot be modified in Collection Replace." \
" They can only be added or removed." in e.http_error_message
await self.test_db.delete_container(container_id)

async def test_fail_create_vector_embedding_policy_async(self):
Expand Down

0 comments on commit a88c145

Please sign in to comment.