mirror of https://github.com/milvus-io/milvus.git
Delete some duplicate query cases (#7863)
Signed-off-by: ThreadDao <yufen.zong@zilliz.com>pull/7872/head
parent
1273f35e94
commit
a275992e8d
|
@ -153,23 +153,6 @@ class TestQueryBase:
|
|||
with pytest.raises(Exception):
|
||||
connect.query(collection, expr)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
def test_query_expr_single_term_array(self, connect, collection):
|
||||
"""
|
||||
target: test query with single array term expr
|
||||
method: query with single array value
|
||||
expected: query result is one entity
|
||||
"""
|
||||
entities, ids = init_data(connect, collection)
|
||||
assert len(ids) == ut.default_nb
|
||||
connect.load_collection(collection)
|
||||
term_expr = f'{default_int_field_name} in [0]'
|
||||
res = connect.query(collection, term_expr, output_fields=["*", "%"])
|
||||
assert len(res) == 1
|
||||
assert res[0][default_int_field_name] == entities[0]["values"][0]
|
||||
assert res[0][default_float_field_name] == entities[1]["values"][0]
|
||||
ut.assert_equal_vector(res[0][ut.default_float_vec_field_name], entities[2]["values"][0])
|
||||
|
||||
@pytest.mark.xfail(reason="#6072")
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
def test_query_binary_expr_single_term_array(self, connect, binary_collection):
|
||||
|
@ -206,65 +189,6 @@ class TestQueryBase:
|
|||
assert res[index][default_float_field_name] == entities[1]["values"][index]
|
||||
ut.assert_equal_vector(res[index][ut.default_float_vec_field_name], entities[2]["values"][index])
|
||||
|
||||
# @pytest.mark.tags(CaseLabel.L0)
|
||||
@pytest.mark.xfail(reason="Need to discuss")
|
||||
def test_query_expr_repeated_term_array(self, connect, collection):
|
||||
"""
|
||||
target: test query with repeated term array on primary field with unique value
|
||||
method: query with repeated array value
|
||||
expected: verify query result
|
||||
"""
|
||||
entities, ids = init_data(connect, collection)
|
||||
assert len(ids) == ut.default_nb
|
||||
connect.load_collection(collection)
|
||||
int_values = [0, 0]
|
||||
term_expr = f'{default_int_field_name} in {int_values}'
|
||||
res = connect.query(collection, term_expr)
|
||||
assert len(res) == 2
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
def test_query_expr_inconstant_term_array(self, connect, collection):
|
||||
"""
|
||||
target: test query with term expr that field and array are inconsistent
|
||||
method: query with int field and float values
|
||||
expected: raise exception
|
||||
"""
|
||||
entities, ids = init_data(connect, collection)
|
||||
assert len(ids) == ut.default_nb
|
||||
connect.load_collection(collection)
|
||||
expr = f'{default_int_field_name} in [1.0, 2.0]'
|
||||
with pytest.raises(Exception):
|
||||
connect.query(collection, expr)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
def test_query_expr_mix_term_array(self, connect, collection):
|
||||
"""
|
||||
target: test query with mix type value expr
|
||||
method: query with term expr that has int and float type value
|
||||
expected: todo
|
||||
"""
|
||||
entities, ids = init_data(connect, collection)
|
||||
assert len(ids) == ut.default_nb
|
||||
connect.load_collection(collection)
|
||||
expr = f'{default_int_field_name} in [1, 2.]'
|
||||
with pytest.raises(Exception):
|
||||
connect.query(collection, expr)
|
||||
|
||||
@pytest.mark.parametrize("constant", [[1], (), {}])
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
def test_query_expr_non_constant_array_term(self, connect, collection, constant):
|
||||
"""
|
||||
target: test query with non-constant array term expr
|
||||
method: query with non-constant array expr
|
||||
expected: raise exception
|
||||
"""
|
||||
entities, ids = init_data(connect, collection)
|
||||
assert len(ids) == ut.default_nb
|
||||
connect.load_collection(collection)
|
||||
expr = f'{default_int_field_name} in [{constant}]'
|
||||
with pytest.raises(Exception):
|
||||
connect.query(collection, expr)
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
def test_query_output_field_empty(self, connect, collection):
|
||||
"""
|
||||
|
@ -280,36 +204,6 @@ class TestQueryBase:
|
|||
assert default_float_field_name not in res[0].keys()
|
||||
assert ut.default_float_vec_field_name not in res[0].keys()
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
def test_query_output_one_field(self, connect, collection):
|
||||
"""
|
||||
target: test query with output one field
|
||||
method: query with output one field
|
||||
expected: return one field
|
||||
"""
|
||||
entities, ids = init_data(connect, collection)
|
||||
assert len(ids) == ut.default_nb
|
||||
connect.load_collection(collection)
|
||||
res = connect.query(collection, default_term_expr, output_fields=[default_int_field_name])
|
||||
assert default_int_field_name in res[0].keys()
|
||||
assert len(res[0].keys()) == 1
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
def test_query_output_all_fields(self, connect, collection):
|
||||
"""
|
||||
target: test query with none output field
|
||||
method: query with output field=None
|
||||
expected: return all fields
|
||||
"""
|
||||
entities, ids = init_data(connect, collection)
|
||||
assert len(ids) == ut.default_nb
|
||||
connect.load_collection(collection)
|
||||
# fields = [default_int_field_name, default_float_field_name, ut.default_float_vec_field_name]
|
||||
fields = [default_int_field_name, default_float_field_name]
|
||||
res = connect.query(collection, default_term_expr, output_fields=fields)
|
||||
for field in fields:
|
||||
assert field in res[0].keys()
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L0)
|
||||
def test_query_output_not_existed_field(self, connect, collection):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue