当前位置: 首页>>代码示例>>Python>>正文


Python Validator.check_task_configuration方法代码示例

本文整理汇总了Python中aeneas.validator.Validator.check_task_configuration方法的典型用法代码示例。如果您正苦于以下问题:Python Validator.check_task_configuration方法的具体用法?Python Validator.check_task_configuration怎么用?Python Validator.check_task_configuration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在aeneas.validator.Validator的用法示例。


在下文中一共展示了Validator.check_task_configuration方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_check_task_configuration_20

# 需要导入模块: from aeneas.validator import Validator [as 别名]
# 或者: from aeneas.validator.Validator import check_task_configuration [as 别名]
 def test_check_task_configuration_20(self):
     logger = Logger()
     validator = Validator(logger=logger)
     string = "task_language=it|is_text_type=plain|os_task_file_name=output.txt|os_task_file_format=smil|os_task_file_smil_page_ref=page.xhtml|os_task_file_smil_audio_ref=../Audio/audio.mp3"
     result = validator.check_task_configuration(string)
     self.assertTrue(result.passed)
     self.assertEqual(len(result.errors), 0)
开发者ID:cbeer,项目名称:aeneas,代码行数:9,代码来源:test_validator.py

示例2: main

# 需要导入模块: from aeneas.validator import Validator [as 别名]
# 或者: from aeneas.validator.Validator import check_task_configuration [as 别名]
def main():
    """ Entry point """
    if len(sys.argv) < 3:
        usage()
        return
    validator = Validator()
    mode = sys.argv[1]
    result = None
    msg = ""

    if mode == "config":
        if sys.argv[2].endswith(".txt"):
            try:
                config_file = open(sys.argv[2], "r")
                config_contents = config_file.read()
                config_file.close()
                result = validator.check_contents_txt_config_file(config_contents, True)
                msg = "TXT configuration"
            except:
                print "[ERRO] Unable to read file %s" % sys.argv[2]
        elif sys.argv[2].endswith(".xml"):
            try:
                config_file = open(sys.argv[2], "r")
                config_contents = config_file.read()
                config_file.close()
                result = validator.check_contents_xml_config_file(config_contents)
                msg = "XML configuration"
            except:
                print "[ERRO] Unable to read file %s" % sys.argv[2]
        else:
            usage()
            return
    elif mode == "container":
        result = validator.check_container(sys.argv[2])
        msg = "container"
    elif mode == "job":
        result = validator.check_job_configuration(sys.argv[2])
        msg = "job configuration string"
    elif mode == "task":
        result = validator.check_task_configuration(sys.argv[2])
        msg = "task configuration string"
    elif mode == "wizard":
        if len(sys.argv) < 4:
            usage()
            return
        result = validator.check_container_from_wizard(sys.argv[2], sys.argv[3])
        msg = "container + configuration string from wizard"
    else:
        usage()
        return

    if result.passed:
        print "[INFO] Valid %s" % msg
        if len(result.warnings) > 0:
            for warning in result.warnings:
                print "[WARN] " + warning
    else:
        print "[INFO] Invalid %s" % msg
        for error in result.errors:
            print "[ERRO] " + error
开发者ID:fduch2k,项目名称:aeneas,代码行数:62,代码来源:validate.py

示例3: test_check_task_configuration_23

# 需要导入模块: from aeneas.validator import Validator [as 别名]
# 或者: from aeneas.validator.Validator import check_task_configuration [as 别名]
 def test_check_task_configuration_23(self):
     logger = Logger()
     validator = Validator(logger=logger)
     string = "task_language=it|is_text_type=plain|os_task_file_name=output.txt|os_task_file_format=smil"
     result = validator.check_task_configuration(string)
     self.assertFalse(result.passed)
     self.assertGreater(len(result.errors), 0)
开发者ID:cbeer,项目名称:aeneas,代码行数:9,代码来源:test_validator.py

示例4: test_check_task_configuration_16

# 需要导入模块: from aeneas.validator import Validator [as 别名]
# 或者: from aeneas.validator.Validator import check_task_configuration [as 别名]
 def test_check_task_configuration_16(self):
     logger = Logger()
     validator = Validator(logger=logger)
     string = "task_language=it|is_text_type=unparsed|is_text_unparsed_id_regex=f[0-9]*|is_text_unparsed_id_sort=numeric|os_task_file_name=output.txt|os_task_file_format=txt"
     result = validator.check_task_configuration(string)
     self.assertTrue(result.passed)
     self.assertEqual(len(result.errors), 0)
开发者ID:cbeer,项目名称:aeneas,代码行数:9,代码来源:test_validator.py

示例5: test_check_task_configuration_19

# 需要导入模块: from aeneas.validator import Validator [as 别名]
# 或者: from aeneas.validator.Validator import check_task_configuration [as 别名]
 def test_check_task_configuration_19(self):
     logger = Logger()
     validator = Validator(logger=logger)
     string = "task_language=it|is_text_type=unparsed|is_text_unparsed_class_regex=ra|is_text_unparsed_id_regex=f[0-9]*|os_task_file_name=output.txt|os_task_file_format=txt"
     result = validator.check_task_configuration(string)
     self.assertFalse(result.passed)
     self.assertGreater(len(result.errors), 0)
开发者ID:cbeer,项目名称:aeneas,代码行数:9,代码来源:test_validator.py

示例6: test_check_task_configuration_08

# 需要导入模块: from aeneas.validator import Validator [as 别名]
# 或者: from aeneas.validator.Validator import check_task_configuration [as 别名]
 def test_check_task_configuration_08(self):
     logger = Logger()
     validator = Validator(logger=logger)
     string = "task_language=it|is_text_type=plain|missing=other"
     result = validator.check_task_configuration(string)
     self.assertFalse(result.passed)
     self.assertGreater(len(result.errors), 0)
开发者ID:cbeer,项目名称:aeneas,代码行数:9,代码来源:test_validator.py

示例7: test_check_task_configuration_06

# 需要导入模块: from aeneas.validator import Validator [as 别名]
# 或者: from aeneas.validator.Validator import check_task_configuration [as 别名]
 def test_check_task_configuration_06(self):
     logger = Logger()
     validator = Validator(logger=logger)
     string = "not=relevant|config=string"
     result = validator.check_task_configuration(string)
     self.assertFalse(result.passed)
     self.assertGreater(len(result.errors), 0)
开发者ID:cbeer,项目名称:aeneas,代码行数:9,代码来源:test_validator.py

示例8: test_check_task_configuration_05

# 需要导入模块: from aeneas.validator import Validator [as 别名]
# 或者: from aeneas.validator.Validator import check_task_configuration [as 别名]
 def test_check_task_configuration_05(self):
     logger = Logger()
     validator = Validator(logger=logger)
     string = "malformed="
     result = validator.check_task_configuration(string)
     self.assertFalse(result.passed)
     self.assertGreater(len(result.errors), 0)
开发者ID:cbeer,项目名称:aeneas,代码行数:9,代码来源:test_validator.py

示例9: test_check_task_configuration_02

# 需要导入模块: from aeneas.validator import Validator [as 别名]
# 或者: from aeneas.validator.Validator import check_task_configuration [as 别名]
 def test_check_task_configuration_02(self):
     logger = Logger()
     validator = Validator(logger=logger)
     string = "dummy config string with ~ reserved characters"
     result = validator.check_task_configuration(string)
     self.assertFalse(result.passed)
     self.assertGreater(len(result.errors), 0)
开发者ID:cbeer,项目名称:aeneas,代码行数:9,代码来源:test_validator.py

示例10: test_check_task_configuration_01

# 需要导入模块: from aeneas.validator import Validator [as 别名]
# 或者: from aeneas.validator.Validator import check_task_configuration [as 别名]
 def test_check_task_configuration_01(self):
     logger = Logger()
     validator = Validator(logger=logger)
     string = u"dummy config string with bad encoding é".encode("latin-1")
     result = validator.check_task_configuration(string)
     self.assertFalse(result.passed)
     self.assertGreater(len(result.errors), 0)
开发者ID:cbeer,项目名称:aeneas,代码行数:9,代码来源:test_validator.py

示例11: tc

# 需要导入模块: from aeneas.validator import Validator [as 别名]
# 或者: from aeneas.validator.Validator import check_task_configuration [as 别名]
 def tc(self, string, expected):
     validator = Validator()
     result = validator.check_task_configuration(string)
     self.assertEqual(result.passed, expected)
     if expected:
         self.assertEqual(len(result.errors), 0)
     else:
         self.assertGreater(len(result.errors), 0)
开发者ID:fduch2k,项目名称:aeneas,代码行数:10,代码来源:test_validator.py


注:本文中的aeneas.validator.Validator.check_task_configuration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。