本文整理汇总了Python中validator.errorbundler.ErrorBundle.set_tier方法的典型用法代码示例。如果您正苦于以下问题:Python ErrorBundle.set_tier方法的具体用法?Python ErrorBundle.set_tier怎么用?Python ErrorBundle.set_tier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类validator.errorbundler.ErrorBundle
的用法示例。
在下文中一共展示了ErrorBundle.set_tier方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_xpi_tiererror
# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import set_tier [as 别名]
def test_xpi_tiererror():
'Tests that tiers are reset when a subpackage is encountered'
err = ErrorBundle()
mock_package = MockXPI(
{'foo.xpi': 'tests/resources/content/subpackage.jar'})
err.set_tier(2)
content.test_packed_packages(err, mock_package)
assert err.errors[0]['tier'] == 1
assert err.tier == 2
assert all(x == 1 for x in content.testendpoint_validator.found_tiers)
示例2: test_xpi_tiererror
# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import set_tier [as 别名]
def test_xpi_tiererror():
"Tests that tiers are reset when a subpackage is encountered"
err = ErrorBundle()
mock_package = MockXPI(
{"foo.xpi": "tests/resources/content/subpackage.jar"})
err.set_tier(2)
result = content.test_packed_packages(err, mock_package)
assert err.errors[0]["tier"] == 1
assert err.tier == 2
assert all(x == 1 for x in content.testendpoint_validator.found_tiers)
示例3: test_json
# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import set_tier [as 别名]
def test_json():
"""Test the JSON output capability of the error bundler."""
# Use the StringIO as an output buffer.
bundle = ErrorBundle()
bundle.detected_type = 4
bundle.set_tier(4)
bundle.set_tier(3)
bundle.error((), "error", "description")
bundle.warning((), "warning", "description")
bundle.notice((), "notice", "description")
results = json.loads(bundle.render_json())
print results
assert len(results["messages"]) == 3
assert results["detected_type"] == "langpack"
assert not results["success"]
assert results["ending_tier"] == 4
示例4: test_json
# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import set_tier [as 别名]
def test_json():
"""Test the JSON output capability of the error bundler."""
# Use the StringIO as an output buffer.
bundle = ErrorBundle() # No color since no output
bundle.detected_type = 4
bundle.set_tier(4)
bundle.set_tier(3)
bundle.error((), 'error', 'description')
bundle.warning((), 'warning', 'description')
bundle.notice((), 'notice', 'description')
results = json.loads(bundle.render_json())
print results
assert len(results['messages']) == 3
assert results['detected_type'] == 'langpack'
assert not results['success']
assert results['ending_tier'] == 4