Files
qdrant-client/tests/congruence_tests/test_count.py
George b350c2c2d9 new: assert for with_vector (#185)
* new: assert for with_vector

* new: assert kwargs is empty

* fix: fix kwargs in count and scroll tests
2023-06-09 16:36:08 +02:00

48 lines
1.3 KiB
Python

from qdrant_client.client_base import QdrantBase
from qdrant_client.http import models
from tests.congruence_tests.test_common import (
COLLECTION_NAME,
compare_client_results,
generate_fixtures,
init_client,
init_local,
init_remote,
)
from tests.fixtures.filters import one_random_filter_please
def count_all(client: QdrantBase) -> int:
return client.count(
collection_name=COLLECTION_NAME,
count_filter=None,
).count
def filter_count(client: QdrantBase, count_filter: models.Filter) -> int:
return client.count(
collection_name=COLLECTION_NAME,
count_filter=count_filter,
).count
def test_simple_search():
fixture_records = generate_fixtures()
local_client = init_local()
init_client(local_client, fixture_records)
remote_client = init_remote()
init_client(remote_client, fixture_records)
compare_client_results(local_client, remote_client, count_all)
for i in range(100):
count_filter = one_random_filter_please()
try:
compare_client_results(
local_client, remote_client, filter_count, count_filter=count_filter
)
except AssertionError as e:
print(f"\nFailed with filter {query_filter}")
raise e