From a88c14555f6305c5beaa81ab243269eb5a64bc7a Mon Sep 17 00:00:00 2001 From: Simon Moreno <30335873+simorenoh@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:07:54 -0700 Subject: [PATCH] update vector policy and vector query tests (#37647) --- sdk/cosmos/azure-cosmos/test/test_query_vector_similarity.py | 2 +- .../azure-cosmos/test/test_query_vector_similarity_async.py | 2 +- sdk/cosmos/azure-cosmos/test/test_vector_policy.py | 3 ++- sdk/cosmos/azure-cosmos/test/test_vector_policy_async.py | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sdk/cosmos/azure-cosmos/test/test_query_vector_similarity.py b/sdk/cosmos/azure-cosmos/test/test_query_vector_similarity.py index ba13d993e2da..42c3623d126c 100644 --- a/sdk/cosmos/azure-cosmos/test/test_query_vector_similarity.py +++ b/sdk/cosmos/azure-cosmos/test/test_query_vector_similarity.py @@ -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") diff --git a/sdk/cosmos/azure-cosmos/test/test_query_vector_similarity_async.py b/sdk/cosmos/azure-cosmos/test/test_query_vector_similarity_async.py index 1c4684cbf0eb..226688114b4f 100644 --- a/sdk/cosmos/azure-cosmos/test/test_query_vector_similarity_async.py +++ b/sdk/cosmos/azure-cosmos/test/test_query_vector_similarity_async.py @@ -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)] diff --git a/sdk/cosmos/azure-cosmos/test/test_vector_policy.py b/sdk/cosmos/azure-cosmos/test/test_vector_policy.py index da0aeb8ec6a8..0c88cb89c318 100644 --- a/sdk/cosmos/azure-cosmos/test/test_vector_policy.py +++ b/sdk/cosmos/azure-cosmos/test/test_vector_policy.py @@ -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): diff --git a/sdk/cosmos/azure-cosmos/test/test_vector_policy_async.py b/sdk/cosmos/azure-cosmos/test/test_vector_policy_async.py index 19dd48268417..b4ac580ce46c 100644 --- a/sdk/cosmos/azure-cosmos/test/test_vector_policy_async.py +++ b/sdk/cosmos/azure-cosmos/test/test_vector_policy_async.py @@ -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):