From 25c364b03d51300d1c69c4c94e7160bd0a36bf6b Mon Sep 17 00:00:00 2001 From: zhuwenxing Date: Tue, 5 Oct 2021 11:30:13 +0800 Subject: [PATCH] [skip ci]Fix single quoted docstring (#9251) Signed-off-by: zhuwenxing --- .../python_client/testcases/test_search_20.py | 268 +++++++++--------- 1 file changed, 134 insertions(+), 134 deletions(-) diff --git a/tests/python_client/testcases/test_search_20.py b/tests/python_client/testcases/test_search_20.py index eb96f1242d..ef8f784a3e 100644 --- a/tests/python_client/testcases/test_search_20.py +++ b/tests/python_client/testcases/test_search_20.py @@ -1898,9 +1898,9 @@ class TestCollectionSearch(TestcaseBase): def init_data(connect, collection, nb=3000, partition_names=None, auto_id=True): - ''' + """ Generate entities and add it in collection - ''' + """ global entities if nb == 3000: insert_entities = entities @@ -1916,9 +1916,9 @@ def init_data(connect, collection, nb=3000, partition_names=None, auto_id=True): def init_binary_data(connect, collection, nb=3000, insert=True, partition_names=None): - ''' + """ Generate entities and add it in collection - ''' + """ ids = [] global binary_entities global raw_vectors @@ -2023,11 +2023,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) def test_search_flat_top_k(self, connect, collection, get_nq): - ''' + """ target: test basic search function, all the search params is correct, change top-k value method: search with the given vectors, check the result expected: the length of the result is top_k - ''' + """ top_k = 16385 # max top k is 16384 nq = get_nq entities, ids = init_data(connect, collection) @@ -2044,11 +2044,11 @@ class TestSearchBase: @pytest.mark.skip("r0.3-test") def _test_search_field(self, connect, collection, get_top_k, get_nq): - ''' + """ target: test basic search function, all the search params is correct, change top-k value method: search with the given vectors, check the result expected: the length of the result is top_k - ''' + """ top_k = get_top_k nq = get_nq entities, ids = init_data(connect, collection) @@ -2067,13 +2067,13 @@ class TestSearchBase: connect.search(collection, query) def _test_search_after_delete(self, connect, collection, get_top_k, get_nq): - ''' + """ target: test basic search function before and after deletion, all the search params is correct, change top-k value. check issue #4200 method: search with the given vectors, check the result expected: the deleted entities do not exist in the result. - ''' + """ top_k = get_top_k nq = get_nq @@ -2114,11 +2114,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) def test_search_index_empty_partition(self, connect, collection, get_simple_index, get_top_k, get_nq): - ''' + """ target: test basic search function, all the search params is correct, test all index params, and build method: add vectors into collection, search with the given vectors, check the result expected: the length of the result is top_k, search collection with partition tag return empty - ''' + """ top_k = get_top_k nq = get_nq @@ -2147,11 +2147,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) def test_search_index_partitions(self, connect, collection, get_simple_index, get_top_k): - ''' + """ target: test basic search function, all the search params is correct, test all index params, and build method: search collection with the given vectors and tags, check the result expected: the length of the result is top_k - ''' + """ top_k = get_top_k nq = 2 new_tag = "new_tag" @@ -2182,11 +2182,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) def test_search_ip_flat(self, connect, collection, get_simple_index, get_top_k, get_nq): - ''' + """ target: test basic search function, all the search params is correct, change top-k value method: search with the given vectors, check the result expected: the length of the result is top_k - ''' + """ top_k = get_top_k nq = get_nq entities, ids = init_data(connect, collection) @@ -2199,11 +2199,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) def test_search_ip_after_index(self, connect, collection, get_simple_index, get_top_k, get_nq): - ''' + """ target: test basic search function, all the search params is correct, test all index params, and build method: search with the given vectors, check the result expected: the length of the result is top_k - ''' + """ top_k = get_top_k nq = get_nq @@ -2224,11 +2224,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) def test_search_ip_index_empty_partition(self, connect, collection, get_simple_index, get_top_k, get_nq): - ''' + """ target: test basic search function, all the search params is correct, test all index params, and build method: add vectors into collection, search with the given vectors, check the result expected: the length of the result is top_k, search collection with partition tag return empty - ''' + """ top_k = get_top_k nq = get_nq metric_type = "IP" @@ -2257,11 +2257,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) def test_search_ip_index_partitions(self, connect, collection, get_simple_index, get_top_k): - ''' + """ target: test basic search function, all the search params is correct, test all index params, and build method: search collection with the given vectors and tags, check the result expected: the length of the result is top_k - ''' + """ top_k = get_top_k nq = 2 metric_type = "IP" @@ -2290,32 +2290,32 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) def test_search_without_connect(self, dis_connect, collection): - ''' + """ target: test search vectors without connection method: use dis connected instance, call search method and check if search successfully expected: raise exception - ''' + """ with pytest.raises(Exception) as e: res = dis_connect.search(collection, default_query) @pytest.mark.tags(CaseLabel.L2) def test_search_collection_not_existed(self, connect): - ''' + """ target: search collection not existed method: search with the random collection_name, which is not in db expected: status not ok - ''' + """ collection_name = gen_unique_str(uid) with pytest.raises(Exception) as e: res = connect.search(collection_name, default_query) @pytest.mark.tags(CaseLabel.L0) def test_search_distance_l2(self, connect, collection): - ''' + """ target: search collection, and check the result: distance method: compare the return distance value with value computed with Euclidean expected: the return distance equals to the computed value - ''' + """ nq = 2 search_param = {"nprobe": 1} entities, ids = init_data(connect, collection, nb=nq) @@ -2331,11 +2331,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) def test_search_distance_l2_after_index(self, connect, id_collection, get_simple_index): - ''' + """ target: search collection, and check the result: distance method: compare the return distance value with value computed with Inner product expected: the return distance equals to the computed value - ''' + """ index_type = get_simple_index["index_type"] nq = 2 entities, ids = init_data(connect, id_collection, auto_id=False) @@ -2362,11 +2362,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) def test_search_distance_ip(self, connect, collection): - ''' + """ target: search collection, and check the result: distance method: compare the return distance value with value computed with Inner product expected: the return distance equals to the computed value - ''' + """ nq = 2 metirc_type = "IP" search_param = {"nprobe": 1} @@ -2384,11 +2384,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) def test_search_distance_ip_after_index(self, connect, id_collection, get_simple_index): - ''' + """ target: search collection, and check the result: distance method: compare the return distance value with value computed with Inner product expected: the return distance equals to the computed value - ''' + """ index_type = get_simple_index["index_type"] nq = 2 metirc_type = "IP" @@ -2418,11 +2418,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L0) def test_search_distance_jaccard_flat_index(self, connect, binary_collection): - ''' + """ target: search binary_collection, and check the result: distance method: compare the return distance value with value computed with L2 expected: the return distance equals to the computed value - ''' + """ nq = 1 int_vectors, entities, ids = init_binary_data(connect, binary_collection, nb=2) query_int_vectors, query_entities, tmp_ids = init_binary_data(connect, binary_collection, nb=1, insert=False) @@ -2435,11 +2435,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) def test_search_binary_flat_with_L2(self, connect, binary_collection): - ''' + """ target: search binary_collection, and check the result: distance method: compare the return distance value with value computed with L2 expected: the return distance equals to the computed value - ''' + """ nq = 1 int_vectors, entities, ids = init_binary_data(connect, binary_collection, nb=2) query_int_vectors, query_entities, tmp_ids = init_binary_data(connect, binary_collection, nb=1, insert=False) @@ -2449,11 +2449,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) def test_search_distance_hamming_flat_index(self, connect, binary_collection): - ''' + """ target: search binary_collection, and check the result: distance method: compare the return distance value with value computed with Inner product expected: the return distance equals to the computed value - ''' + """ nq = 1 int_vectors, entities, ids = init_binary_data(connect, binary_collection, nb=2) query_int_vectors, query_entities, tmp_ids = init_binary_data(connect, binary_collection, nb=1, insert=False) @@ -2466,11 +2466,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) def test_search_distance_substructure_flat_index(self, connect, binary_collection): - ''' + """ target: search binary_collection, and check the result: distance method: search with new random binary entities and SUBSTRUCTURE metric type expected: the return distance equals to the computed value - ''' + """ nq = 1 int_vectors, entities, ids = init_binary_data(connect, binary_collection, nb=2) query_int_vectors, query_entities, tmp_ids = init_binary_data(connect, binary_collection, nb=1, insert=False) @@ -2484,11 +2484,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) def test_search_distance_substructure_flat_index_B(self, connect, binary_collection): - ''' + """ target: search binary_collection, and check the result: distance method: search with entities that related to inserted entities expected: the return distance equals to the computed value - ''' + """ top_k = 3 int_vectors, entities, ids = init_binary_data(connect, binary_collection, nb=2) query_int_vectors, query_vecs = gen_binary_sub_vectors(int_vectors, 2) @@ -2503,11 +2503,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) def test_search_distance_superstructure_flat_index(self, connect, binary_collection): - ''' + """ target: search binary_collection, and check the result: distance method: compare the return distance value with value computed with Inner product expected: the return distance equals to the computed value - ''' + """ nq = 1 int_vectors, entities, ids = init_binary_data(connect, binary_collection, nb=2) query_int_vectors, query_entities, tmp_ids = init_binary_data(connect, binary_collection, nb=1, insert=False) @@ -2521,11 +2521,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) def test_search_distance_superstructure_flat_index_B(self, connect, binary_collection): - ''' + """ target: search binary_collection, and check the result: distance method: compare the return distance value with value computed with SUPER expected: the return distance equals to the computed value - ''' + """ top_k = 3 int_vectors, entities, ids = init_binary_data(connect, binary_collection, nb=2) query_int_vectors, query_vecs = gen_binary_super_vectors(int_vectors, 2) @@ -2542,11 +2542,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) def test_search_distance_tanimoto_flat_index(self, connect, binary_collection): - ''' + """ target: search binary_collection, and check the result: distance method: compare the return distance value with value computed with Inner product expected: the return distance equals to the computed value - ''' + """ nq = 1 int_vectors, entities, ids = init_binary_data(connect, binary_collection, nb=2) query_int_vectors, query_entities, tmp_ids = init_binary_data(connect, binary_collection, nb=1, insert=False) @@ -2560,11 +2560,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) @pytest.mark.timeout(300) def test_search_concurrent_multithreads_single_connection(self, connect, args): - ''' + """ target: test concurrent search with multiprocessess method: search with 10 processes, each process uses dependent connection expected: status ok and the returned vectors should be query_records - ''' + """ nb = 100 top_k = 10 threads_num = 4 @@ -2593,11 +2593,11 @@ class TestSearchBase: @pytest.mark.tags(CaseLabel.L2) def test_search_multi_collections(self, connect, args): - ''' + """ target: test search multi collections of L2 method: add vectors into 10 collections, and search expected: search status ok, the length of result - ''' + """ num = 10 top_k = 10 nq = 20 @@ -2627,10 +2627,10 @@ class TestSearchDSL(object): """ @pytest.mark.tags(CaseLabel.L2) def test_query_no_must(self, connect, collection): - ''' + """ method: build query without must expr expected: error raised - ''' + """ # entities, ids = init_data(connect, collection) query = update_query_expr(default_query, keep_old=False) with pytest.raises(Exception) as e: @@ -2638,10 +2638,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L0) def test_query_no_vector_term_only(self, connect, collection): - ''' + """ method: build query without vector only term expected: error raised - ''' + """ # entities, ids = init_data(connect, collection) expr = { "must": [gen_default_term_expr] @@ -2652,10 +2652,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L0) def test_query_no_vector_range_only(self, connect, collection): - ''' + """ method: build query without vector only range expected: error raised - ''' + """ # entities, ids = init_data(connect, collection) expr = { "must": [gen_default_range_expr] @@ -2674,10 +2674,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L0) def test_query_wrong_format(self, connect, collection): - ''' + """ method: build query without must expr, with wrong expr name expected: error raised - ''' + """ # entities, ids = init_data(connect, collection) expr = { "must1": [gen_default_term_expr] @@ -2688,10 +2688,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L0) def test_query_empty(self, connect, collection): - ''' + """ method: search with empty query expected: error raised - ''' + """ query = {} with pytest.raises(Exception) as e: res = connect.search(collection, query) @@ -2703,10 +2703,10 @@ class TestSearchDSL(object): """ @pytest.mark.tags(CaseLabel.L2) def test_query_term_value_not_in(self, connect, collection): - ''' + """ method: build query with vector and term expr, with no term can be filtered expected: filter pass - ''' + """ entities, ids = init_data(connect, collection) expr = { "must": [gen_default_vector_expr(default_query), gen_default_term_expr(values=[100000])]} @@ -2719,10 +2719,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_term_value_all_in(self, connect, collection): - ''' + """ method: build query with vector and term expr, with all term can be filtered expected: filter pass - ''' + """ entities, ids = init_data(connect, collection) expr = {"must": [gen_default_vector_expr(default_query), gen_default_term_expr(values=[1])]} query = update_query_expr(default_query, expr=expr) @@ -2734,10 +2734,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_term_values_not_in(self, connect, collection): - ''' + """ method: build query with vector and term expr, with no term can be filtered expected: filter pass - ''' + """ entities, ids = init_data(connect, collection) expr = {"must": [gen_default_vector_expr(default_query), gen_default_term_expr(values=[i for i in range(100000, 100010)])]} @@ -2750,10 +2750,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_term_values_all_in(self, connect, collection): - ''' + """ method: build query with vector and term expr, with all term can be filtered expected: filter pass - ''' + """ entities, ids = init_data(connect, collection) expr = {"must": [gen_default_vector_expr(default_query), gen_default_term_expr()]} query = update_query_expr(default_query, expr=expr) @@ -2770,10 +2770,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_term_values_parts_in(self, connect, collection): - ''' + """ method: build query with vector and term expr, with parts of term can be filtered expected: filter pass - ''' + """ entities, ids = init_data(connect, collection) expr = {"must": [gen_default_vector_expr(default_query), gen_default_term_expr( @@ -2787,10 +2787,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_term_values_repeat(self, connect, collection): - ''' + """ method: build query with vector and term expr, with the same values expected: filter pass - ''' + """ entities, ids = init_data(connect, collection) expr = { "must": [gen_default_vector_expr(default_query), @@ -2804,10 +2804,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_term_value_empty(self, connect, collection): - ''' + """ method: build query with term value empty expected: return null - ''' + """ expr = {"must": [gen_default_vector_expr(default_query), gen_default_term_expr(values=[])]} query = update_query_expr(default_query, expr=expr) connect.load_collection(collection) @@ -2817,10 +2817,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L0) def test_query_complex_dsl(self, connect, collection): - ''' + """ method: query with complicated dsl expected: no error raised - ''' + """ expr = {"must": [ {"must": [{"should": [gen_default_term_expr(values=[1]), gen_default_range_expr()]}]}, {"must": [gen_default_vector_expr(default_query)]} @@ -2840,10 +2840,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_term_key_error(self, connect, collection): - ''' + """ method: build query with term key error expected: Exception raised - ''' + """ expr = {"must": [gen_default_vector_expr(default_query), gen_default_term_expr(keyword="terrm", values=[i for i in range(default_nb // 2)])]} query = update_query_expr(default_query, expr=expr) @@ -2859,10 +2859,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_term_wrong_format(self, connect, collection, get_invalid_term): - ''' + """ method: build query with wrong format term expected: Exception raised - ''' + """ entities, ids = init_data(connect, collection) term = get_invalid_term expr = {"must": [gen_default_vector_expr(default_query), term]} @@ -2872,10 +2872,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_term_field_named_term(self, connect, collection): - ''' + """ method: build query with field named "term" expected: error raised - ''' + """ term_fields = add_field_default(default_fields, field_name="term") collection_term = gen_unique_str("term") connect.create_collection(collection_term, term_fields) @@ -2899,10 +2899,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_term_one_field_not_existed(self, connect, collection): - ''' + """ method: build query with two fields term, one of it not existed expected: exception raised - ''' + """ entities, ids = init_data(connect, collection) term = gen_default_term_expr() term["term"].update({"a": [0]}) @@ -2919,10 +2919,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L0) def test_query_range_key_error(self, connect, collection): - ''' + """ method: build query with range key error expected: Exception raised - ''' + """ range = gen_default_range_expr(keyword="ranges") expr = {"must": [gen_default_vector_expr(default_query), range]} query = update_query_expr(default_query, expr=expr) @@ -2938,10 +2938,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_range_wrong_format(self, connect, collection, get_invalid_range): - ''' + """ method: build query with wrong format range expected: Exception raised - ''' + """ entities, ids = init_data(connect, collection) range = get_invalid_range expr = {"must": [gen_default_vector_expr(default_query), range]} @@ -2951,10 +2951,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_range_string_ranges(self, connect, collection): - ''' + """ method: build query with invalid ranges expected: raise Exception - ''' + """ entities, ids = init_data(connect, collection) ranges = {"GT": "0", "LT": "1000"} range = gen_default_range_expr(ranges=ranges) @@ -2965,10 +2965,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_range_invalid_ranges(self, connect, collection): - ''' + """ method: build query with invalid ranges expected: 0 - ''' + """ entities, ids = init_data(connect, collection) ranges = {"GT": default_nb, "LT": 0} range = gen_default_range_expr(ranges=ranges) @@ -2987,10 +2987,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_range_valid_ranges(self, connect, collection, get_valid_ranges): - ''' + """ method: build query with valid ranges expected: pass - ''' + """ entities, ids = init_data(connect, collection) ranges = get_valid_ranges range = gen_default_range_expr(ranges=ranges) @@ -3003,10 +3003,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L0) def test_query_range_one_field_not_existed(self, connect, collection): - ''' + """ method: build query with two fields ranges, one of fields not existed expected: exception raised - ''' + """ entities, ids = init_data(connect, collection) range = gen_default_range_expr() range["range"].update({"a": {"GT": 1, "LT": default_nb // 2}}) @@ -3022,10 +3022,10 @@ class TestSearchDSL(object): """ @pytest.mark.tags(CaseLabel.L2) def test_query_multi_term_has_common(self, connect, collection): - ''' + """ method: build query with multi term with same field, and values has common expected: pass - ''' + """ entities, ids = init_data(connect, collection) term_first = gen_default_term_expr() term_second = gen_default_term_expr(values=[i for i in range(default_nb // 3)]) @@ -3038,10 +3038,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_multi_term_no_common(self, connect, collection): - ''' + """ method: build query with multi range with same field, and ranges no common expected: pass - ''' + """ entities, ids = init_data(connect, collection) term_first = gen_default_term_expr() term_second = gen_default_term_expr(values=[i for i in range(default_nb // 2, default_nb + default_nb // 2)]) @@ -3054,10 +3054,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_multi_term_different_fields(self, connect, collection): - ''' + """ method: build query with multi range with same field, and ranges no common expected: pass - ''' + """ entities, ids = init_data(connect, collection) term_first = gen_default_term_expr() term_second = gen_default_term_expr(field="float", @@ -3071,10 +3071,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_single_term_multi_fields(self, connect, collection): - ''' + """ method: build query with multi term, different field each term expected: pass - ''' + """ entities, ids = init_data(connect, collection) term_first = {"int64": {"values": [i for i in range(default_nb // 2)]}} term_second = {"float": {"values": [float(i) for i in range(default_nb // 2, default_nb)]}} @@ -3086,10 +3086,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_multi_range_has_common(self, connect, collection): - ''' + """ method: build query with multi range with same field, and ranges has common expected: pass - ''' + """ entities, ids = init_data(connect, collection) range_one = gen_default_range_expr() range_two = gen_default_range_expr(ranges={"GT": 1, "LT": default_nb // 3}) @@ -3102,10 +3102,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_multi_range_no_common(self, connect, collection): - ''' + """ method: build query with multi range with same field, and ranges no common expected: pass - ''' + """ entities, ids = init_data(connect, collection) range_one = gen_default_range_expr() range_two = gen_default_range_expr(ranges={"GT": default_nb // 2, "LT": default_nb}) @@ -3118,10 +3118,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_multi_range_different_fields(self, connect, collection): - ''' + """ method: build query with multi range, different field each range expected: pass - ''' + """ entities, ids = init_data(connect, collection) range_first = gen_default_range_expr() range_second = gen_default_range_expr(field="float", ranges={"GT": default_nb // 2, "LT": default_nb}) @@ -3134,10 +3134,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_single_range_multi_fields(self, connect, collection): - ''' + """ method: build query with multi range, different field each range expected: pass - ''' + """ entities, ids = init_data(connect, collection) range_first = {"int64": {"GT": 0, "LT": default_nb // 2}} range_second = {"float": {"GT": default_nb / 2, "LT": float(default_nb)}} @@ -3154,10 +3154,10 @@ class TestSearchDSL(object): """ @pytest.mark.tags(CaseLabel.L2) def test_query_single_term_range_has_common(self, connect, collection): - ''' + """ method: build query with single term single range expected: pass - ''' + """ entities, ids = init_data(connect, collection) term = gen_default_term_expr() range = gen_default_range_expr(ranges={"GT": -1, "LT": default_nb // 2}) @@ -3170,10 +3170,10 @@ class TestSearchDSL(object): @pytest.mark.tags(CaseLabel.L2) def test_query_single_term_range_no_common(self, connect, collection): - ''' + """ method: build query with single term single range expected: pass - ''' + """ entities, ids = init_data(connect, collection) term = gen_default_term_expr() range = gen_default_range_expr(ranges={"GT": default_nb // 2, "LT": default_nb}) @@ -3191,10 +3191,10 @@ class TestSearchDSL(object): """ @pytest.mark.tags(CaseLabel.L2) def test_query_multi_vectors_same_field(self, connect, collection): - ''' + """ method: build query with two vectors same field expected: error raised - ''' + """ entities, ids = init_data(connect, collection) vector1 = default_query vector2 = gen_query_vectors(field_name, entities, default_top_k, nq=2) @@ -3215,10 +3215,10 @@ class TestSearchDSLBools(object): @pytest.mark.tags(CaseLabel.L2) def test_query_no_bool(self, connect, collection): - ''' + """ method: build query without bool expr expected: error raised - ''' + """ entities, ids = init_data(connect, collection) expr = {"bool1": {}} query = expr @@ -3227,10 +3227,10 @@ class TestSearchDSLBools(object): @pytest.mark.tags(CaseLabel.L0) def test_query_should_only_term(self, connect, collection): - ''' + """ method: build query without must, with should.term instead expected: error raised - ''' + """ expr = {"should": gen_default_term_expr} query = update_query_expr(default_query, keep_old=False, expr=expr) with pytest.raises(Exception) as e: @@ -3238,10 +3238,10 @@ class TestSearchDSLBools(object): @pytest.mark.tags(CaseLabel.L0) def test_query_should_only_vector(self, connect, collection): - ''' + """ method: build query without must, with should.vector instead expected: error raised - ''' + """ expr = {"should": default_query["bool"]["must"]} query = update_query_expr(default_query, keep_old=False, expr=expr) with pytest.raises(Exception) as e: @@ -3249,10 +3249,10 @@ class TestSearchDSLBools(object): @pytest.mark.tags(CaseLabel.L2) def test_query_must_not_only_term(self, connect, collection): - ''' + """ method: build query without must, with must_not.term instead expected: error raised - ''' + """ expr = {"must_not": gen_default_term_expr} query = update_query_expr(default_query, keep_old=False, expr=expr) with pytest.raises(Exception) as e: @@ -3260,10 +3260,10 @@ class TestSearchDSLBools(object): @pytest.mark.tags(CaseLabel.L2) def test_query_must_not_vector(self, connect, collection): - ''' + """ method: build query without must, with must_not.vector instead expected: error raised - ''' + """ expr = {"must_not": default_query["bool"]["must"]} query = update_query_expr(default_query, keep_old=False, expr=expr) with pytest.raises(Exception) as e: @@ -3271,10 +3271,10 @@ class TestSearchDSLBools(object): @pytest.mark.tags(CaseLabel.L2) def test_query_must_should(self, connect, collection): - ''' + """ method: build query must, and with should.term expected: error raised - ''' + """ expr = {"should": gen_default_term_expr} query = update_query_expr(default_query, keep_old=True, expr=expr) with pytest.raises(Exception) as e: