Files
qdrant/openapi/tests/openapi_integration/test_count.py
Arnaud Gourlay 25d1383496 List aliases API (rest & gRPC) (#1363)
* List aliases API (rest & gRPC)

* rework api to avoid conflicts
2023-02-06 15:15:52 +01:00

72 lines
2.0 KiB
Python

import pytest
from .helpers.collection_setup import basic_collection_setup, drop_collection
from .helpers.helpers import request_with_validation
collection_name = 'test_collection_threshold'
@pytest.fixture(autouse=True)
def setup():
basic_collection_setup(collection_name=collection_name)
yield
drop_collection(collection_name=collection_name)
def test_exact_count_search():
response = request_with_validation(
api='/collections/{collection_name}/points/count',
method="POST",
path_params={'collection_name': collection_name},
body={
"filter": {
"should": [
{
"key": "city",
"match": {
"value": "London"
}
},
{
"key": "city",
"match": {
"value": "Berlin"
}
}
]
}
}
)
assert response.ok
assert response.json()['result']['count'] == 4
def test_approx_count_search():
response = request_with_validation(
api='/collections/{collection_name}/points/count',
method="POST",
path_params={'collection_name': collection_name},
body={
"filter": {
"should": [
{
"key": "city",
"match": {
"value": "London"
}
},
{
"key": "city",
"match": {
"value": "Berlin"
}
}
]
},
"exact": False
}
)
assert response.ok
assert response.json()['result']['count'] < 6
assert response.json()['result']['count'] > 0