本文整理汇总了Python中appvalidator.errorbundle.ErrorBundle.set_type方法的典型用法代码示例。如果您正苦于以下问题:Python ErrorBundle.set_type方法的具体用法?Python ErrorBundle.set_type怎么用?Python ErrorBundle.set_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类appvalidator.errorbundle.ErrorBundle
的用法示例。
在下文中一共展示了ErrorBundle.set_type方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _test_xul_raw
# 需要导入模块: from appvalidator.errorbundle import ErrorBundle [as 别名]
# 或者: from appvalidator.errorbundle.ErrorBundle import set_type [as 别名]
def _test_xul_raw(data, path, should_fail=False, should_fail_csp=None, type_=None):
filename = path.split("/")[-1]
extension = filename.split(".")[-1]
err = ErrorBundle()
err.save_resource("app_type", "certified")
if type_:
err.set_type(type_)
parser = markuptester.MarkupParser(err, debug=True)
parser.process(filename, data, extension)
print err.print_summary(verbose=True)
if should_fail:
assert any(m for m in (err.errors + err.warnings) if m["id"][0] != "csp")
else:
assert not any(m for m in (err.errors + err.warnings) if m["id"][0] != "csp")
if should_fail_csp == True:
assert any(m for m in (err.errors + err.warnings) if m["id"][0] == "csp")
elif should_fail_csp == False:
assert not any(m for m in (err.errors + err.warnings) if m["id"][0] == "csp")
return err
示例2: _do_test
# 需要导入模块: from appvalidator.errorbundle import ErrorBundle [as 别名]
# 或者: from appvalidator.errorbundle.ErrorBundle import set_type [as 别名]
def _do_test(path, test, failure=True, set_type=0,
listed=False, xpi_mode="r"):
package_data = open(path, "rb")
package = ZipPackage(package_data, mode=xpi_mode, name=path)
err = ErrorBundle()
if listed:
err.save_resource("listed", True)
# Populate in the dependencies.
if set_type:
err.set_type(set_type) # Conduit test requires type
test(err, package)
print err.print_summary(verbose=True)
assert err.failed() if failure else not err.failed()
return err