Beispiel #1
0
    def check_query_results(query_res, func_name, check_items):
        """
        According to the check_items to check actual query result, which return from func_name.

        :param: query_res: A list that contains all results
        :type: list

        :param func_name: Query API name
        :type func_name: str

        :param check_items: The items expected to be checked, including exp_res, with_vec
                            The type of exp_res value is as same as query_res
                            The type of with_vec value is bool, True value means check vector field, False otherwise
        :type check_items: dict
        """
        if func_name != 'query':
            log.warning("The function name is {} rather than {}".format(
                func_name, "query"))
        if not isinstance(query_res, list):
            raise Exception("The query result to check isn't list type object")
        if len(check_items) == 0:
            raise Exception("No expect values found in the check task")
        exp_res = check_items.get("exp_res", None)
        with_vec = check_items.get("with_vec", False)
        if exp_res and isinstance(query_res, list):
            assert pc.equal_entities_list(exp=exp_res,
                                          actual=query_res,
                                          with_vec=with_vec)
Beispiel #2
0
 def check_query_results(query_res, func_name, check_items):
     if func_name != 'query':
         log.warning("The function name is {} rather than {}".format(func_name, "query"))
     if not isinstance(query_res, list):
         raise Exception("The query result to check isn't list type object")
     if len(check_items) == 0:
         raise Exception("No expect values found in the check task")
     exp_res = check_items.get("exp_res", None)
     with_vec = check_items.get("with_vec", False)
     if exp_res and isinstance(query_res, list):
         assert pc.equal_entities_list(exp=exp_res, actual=query_res, with_vec=with_vec)