def _check_format ( file_path , content ) : # TODO: replace with JSON schema validation if not content : # testcase file content is empty err_msg = u"Testcase file content is empty: {}" . format ( file_path ) logger . log_error ( err_msg ) raise exceptions . FileFormatError ( err_msg ) elif not isinstance ( content , ( list , dict ) ) : # testcase file content does not match testcase format err_msg = u"Testcase file content format invalid: {}" . format ( file_path ) logger . log_error ( err_msg ) raise exceptions . FileFormatError ( err_msg )
python test, how to make sure data format is correct
check testcase format if valid
def _check_format(file_path, content):
    """ check testcase format if valid
    """
    # TODO: replace with JSON schema validation
    if not content:
        # testcase file content is empty
        err_msg = u"Testcase file content is empty: {}".format(file_path)
        logger.log_error(err_msg)
        raise exceptions.FileFormatError(err_msg)

    elif not isinstance(content, (list, dict)):
        # testcase file content does not match testcase format
        err_msg = u"Testcase file content format invalid: {}".format(file_path)
        logger.log_error(err_msg)
        raise exceptions.FileFormatError(err_msg)