|
@@ 1311-1327 (lines=17) @@
|
| 1308 |
|
with pytest.raises(Exception) as e: |
| 1309 |
|
res = connect.search(collection, query) |
| 1310 |
|
|
| 1311 |
|
@pytest.mark.level(2) |
| 1312 |
|
def test_search_with_empty_params(self, connect, collection, args, get_simple_index): |
| 1313 |
|
''' |
| 1314 |
|
target: test search fuction, with empty search params |
| 1315 |
|
method: search with params |
| 1316 |
|
expected: raise an error, and the connection is normal |
| 1317 |
|
''' |
| 1318 |
|
index_type = get_simple_index["index_type"] |
| 1319 |
|
if args["handler"] == "HTTP": |
| 1320 |
|
pytest.skip("skip in http mode") |
| 1321 |
|
if index_type == "FLAT": |
| 1322 |
|
pytest.skip("skip in FLAT index") |
| 1323 |
|
entities, ids = init_data(connect, collection) |
| 1324 |
|
connect.create_index(collection, field_name, get_simple_index) |
| 1325 |
|
query, vecs = gen_query_vectors(field_name, entities, top_k, 1, search_params={}) |
| 1326 |
|
with pytest.raises(Exception) as e: |
| 1327 |
|
res = connect.search(collection, query) |
| 1328 |
|
|
| 1329 |
|
|
| 1330 |
|
def check_id_result(result, id): |
|
@@ 1294-1309 (lines=16) @@
|
| 1291 |
|
yield request.param |
| 1292 |
|
|
| 1293 |
|
# TODO: This case can all pass, but it's too slow |
| 1294 |
|
@pytest.mark.level(2) |
| 1295 |
|
def _test_search_with_invalid_params(self, connect, collection, get_simple_index, get_search_params): |
| 1296 |
|
''' |
| 1297 |
|
target: test search fuction, with the wrong nprobe |
| 1298 |
|
method: search with nprobe |
| 1299 |
|
expected: raise an error, and the connection is normal |
| 1300 |
|
''' |
| 1301 |
|
search_params = get_search_params |
| 1302 |
|
index_type = get_simple_index["index_type"] |
| 1303 |
|
entities, ids = init_data(connect, collection) |
| 1304 |
|
connect.create_index(collection, field_name, get_simple_index) |
| 1305 |
|
if search_params["index_type"] != index_type: |
| 1306 |
|
pytest.skip("Skip case") |
| 1307 |
|
query, vecs = gen_query_vectors(field_name, entities, top_k, 1, search_params=search_params["search_params"]) |
| 1308 |
|
with pytest.raises(Exception) as e: |
| 1309 |
|
res = connect.search(collection, query) |
| 1310 |
|
|
| 1311 |
|
@pytest.mark.level(2) |
| 1312 |
|
def test_search_with_empty_params(self, connect, collection, args, get_simple_index): |