2023-04-05 13:15:01 +02:00
|
|
|
from .helpers.helpers import request_with_validation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# validate that malformed conditions raise a JsonSchema ValidationError
|
|
|
|
|
|
2024-11-06 20:09:31 +01:00
|
|
|
def test_malformed_condition(collection_name):
|
2023-04-05 13:15:01 +02:00
|
|
|
# Should raise a ValidationError because the condition key is not defined
|
|
|
|
|
# see https://github.com/qdrant/qdrant/issues/1664
|
|
|
|
|
# with pytest.raises(jsonschema.exceptions.ValidationError):
|
2024-11-06 20:09:31 +01:00
|
|
|
malformed_condition(collection_name)
|
2023-04-05 13:15:01 +02:00
|
|
|
|
|
|
|
|
|
2024-11-06 20:09:31 +01:00
|
|
|
def malformed_condition(collection_name):
|
2023-04-05 13:15:01 +02:00
|
|
|
request_with_validation(
|
|
|
|
|
api='/collections/{collection_name}/points/search',
|
|
|
|
|
method="POST",
|
|
|
|
|
path_params={'collection_name': collection_name},
|
|
|
|
|
body={
|
|
|
|
|
"vector": [0.2, 0.1, 0.9, 0.7],
|
|
|
|
|
"limit": 5,
|
|
|
|
|
"filter": {
|
|
|
|
|
"should": [
|
|
|
|
|
{
|
|
|
|
|
"undefined_condition_key": {
|
|
|
|
|
"key": "city"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"with_payload": True
|
|
|
|
|
}
|
|
|
|
|
)
|