本文整理汇总了Python中appvalidator.errorbundle.ErrorBundle.save_resource方法的典型用法代码示例。如果您正苦于以下问题:Python ErrorBundle.save_resource方法的具体用法?Python ErrorBundle.save_resource怎么用?Python ErrorBundle.save_resource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类appvalidator.errorbundle.ErrorBundle
的用法示例。
在下文中一共展示了ErrorBundle.save_resource方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _test_xul_raw
# 需要导入模块: from appvalidator.errorbundle import ErrorBundle [as 别名]
# 或者: from appvalidator.errorbundle.ErrorBundle import save_resource [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 save_resource [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
示例3: do_exit
# 需要导入模块: from appvalidator.errorbundle import ErrorBundle [as 别名]
# 或者: from appvalidator.errorbundle.ErrorBundle import save_resource [as 别名]
print "Context: %s" % a.context
print "<"
print "~" * 50
def do_exit(wrapper, arguments, traverser):
print "Goodbye!"
sys.exit()
GLOBAL_ENTITIES[u"inspect"] = {"return": do_inspect}
GLOBAL_ENTITIES[u"exit"] = {"return": do_exit}
while True:
line = raw_input("js> ")
trav.debug_level = 0
if line == "enable bootstrap\n":
err.save_resource("em:bootstrap", True)
continue
elif line == "disable bootstrap\n":
err.save_resource("em:bootstrap", False)
continue
elif line.startswith(("inspect ", "isglobal ")):
actions = {
"inspect": lambda wrap: wrap.value if wrap.is_global else wrap.output(),
"isglobal": lambda wrap: wrap.is_global,
}
vars = line.split()
final_context = trav.contexts[-1]
for var in vars[1:]:
if var not in final_context.data:
print "%s not found." % var
continue
示例4: test_scripting_enabled
# 需要导入模块: from appvalidator.errorbundle import ErrorBundle [as 别名]
# 或者: from appvalidator.errorbundle.ErrorBundle import save_resource [as 别名]
def test_scripting_enabled():
err = ErrorBundle()
err.save_resource("SPIDERMONKEY", None)
assert scripting.test_js_file(err, "abc def", "foo bar") is None