Skip to content

Commit

Permalink
tests for has-vector
Browse files Browse the repository at this point in the history
  • Loading branch information
generall committed Jan 3, 2025
1 parent 6aad043 commit 5686ed5
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions tests/congruence_tests/test_has_vector.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
from qdrant_client import models
from tests.congruence_tests.test_common import (
COLLECTION_NAME,
compare_client_results,
generate_fixtures,
generate_sparse_fixtures,
init_local,
init_client,
init_remote,
sparse_vectors_config,
)


def test_has_vector(local_client, remote_client):
points = generate_fixtures(100, skip_vectors=True)

local_client.upload_points(COLLECTION_NAME, points)
remote_client.upload_points(COLLECTION_NAME, points, wait=True)

local_client.upload_points(COLLECTION_NAME, points)
remote_client.upload_points(COLLECTION_NAME, points, wait=True)

compare_client_results(
local_client,
remote_client,
lambda c: c.scroll(
COLLECTION_NAME,
limit=50,
scroll_filter=models.Filter(must=[models.HasVectorCondition(has_vector="image")]),
),
)


def test_has_vector_sparse():
points = generate_sparse_fixtures(100, skip_vectors=True)

local_client = init_local()
init_client(local_client, [], sparse_vectors_config=sparse_vectors_config)

remote_client = init_remote()
init_client(remote_client, [], sparse_vectors_config=sparse_vectors_config)

local_client.upload_points(COLLECTION_NAME, points)
remote_client.upload_points(COLLECTION_NAME, points, wait=True)

compare_client_results(
local_client,
remote_client,
lambda c: c.scroll(
COLLECTION_NAME,
limit=50,
scroll_filter=models.Filter(
must=[models.HasVectorCondition(has_vector="sparse-image")]
),
),
)

0 comments on commit 5686ed5

Please sign in to comment.