diff --git a/tests/python_client/base/client_base.py b/tests/python_client/base/client_base.py index c6d57b7b8a..21d151666a 100644 --- a/tests/python_client/base/client_base.py +++ b/tests/python_client/base/client_base.py @@ -346,7 +346,7 @@ class TestcaseBase(Base): :type privilege_object: str :param object_name: privilege object name :type object_name: str - :param privilege: pivilege + :param privilege: privilege :type privilege: str :param db_name: database name :type db_name: str diff --git a/tests/python_client/common/common_func.py b/tests/python_client/common/common_func.py index 70ad6f7ca0..719e5322c0 100644 --- a/tests/python_client/common/common_func.py +++ b/tests/python_client/common/common_func.py @@ -1001,6 +1001,18 @@ def gen_invalid_string_expressions(): return expressions +def gen_invalid_bool_expressions(): + expressions = [ + "bool", + "!bool", + "true", + "false", + "int64 > 0 and bool", + "int64 > 0 or false" + ] + return expressions + + def gen_normal_expressions_field(field): expressions = [ "", diff --git a/tests/python_client/testcases/test_search.py b/tests/python_client/testcases/test_search.py index 5633d270d6..1f7e37c204 100644 --- a/tests/python_client/testcases/test_search.py +++ b/tests/python_client/testcases/test_search.py @@ -505,6 +505,23 @@ class TestCollectionSearchInvalid(TestcaseBase): check_items={"err_code": 1, "err_msg": "failed to create query plan"}) + @pytest.mark.tags(CaseLabel.L2) + @pytest.mark.parametrize("expression", cf.gen_invalid_bool_expressions()) + def test_search_with_expression_invalid_bool(self, expression): + """ + target: test search invalid bool + method: test search invalid bool + expected: searched failed + """ + collection_w = self.init_collection_general(prefix, True, is_all_data_type=True)[0] + log.info("test_search_with_expression: searching with expression: %s" % expression) + collection_w.search(vectors[:default_nq], default_search_field, + default_search_params, default_limit, expression, + check_task=CheckTasks.err_res, + check_items={"err_code": 1, + "err_msg": "failed to create query plan: cannot parse " + "expression: %s" % expression}) + @pytest.mark.tags(CaseLabel.L1) @pytest.mark.parametrize("expression", ["int64 like 33", "float LIKE 33"]) def test_search_with_expression_invalid_like(self, expression):