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


Python ErrorBundle.failed方法代码示例

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


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

示例1: test_overlay_object

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import failed [as 别名]
def test_overlay_object():
    """Test that overlay instructions have all its properties."""

    err = ErrorBundle()

    c = chrome_manifest("""
        content namespace /foo/bar
        overlay namespace /uri/goes/here
    """)

    err.save_resource('chrome.manifest', c)
    c.get_applicable_overlays(err)
    assert not err.failed()
    assert not err.notices

    err = ErrorBundle()

    c = chrome_manifest("""
        content namespace /foo/bar
        overlay /uri/goes/here
    """)
    err.save_resource('chrome.manifest', c)
    c.get_applicable_overlays(err)
    assert err.failed()
    assert not err.notices
开发者ID:kmaglione,项目名称:amo-validator,代码行数:27,代码来源:test_chromemanifest.py

示例2: _run_test_raw

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import failed [as 别名]
def _run_test_raw(data, failure=True, detected_type=0, listed=True,
                  overrides=None, compat=False):
    "Runs a test on an install.rdf snippet"

    data = data.strip()

    err = ErrorBundle()
    err.detected_type = detected_type
    err.save_resource("listed", listed)
    err.overrides = overrides

    if compat:
        err.save_resource("is_compat_test", True)

    err.save_resource("has_install_rdf", True)
    err.save_resource("install_rdf", RDFParser(err, data))
    installrdf.test_install_rdf_params(err)

    print err.print_summary(verbose=True)

    if failure:  # pragma: no cover
        assert err.failed() or err.notices
    else:
        assert not err.failed() and not err.notices

    return err
开发者ID:arcticlab,项目名称:amo-validator,代码行数:28,代码来源:test_installrdf.py

示例3: test_notice

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import failed [as 别名]
def test_notice():
    """Test notice-related functions of the error bundler."""

    # Use the StringIO as an output buffer.
    bundle = ErrorBundle()

    bundle.notice((), "")

    # Load the JSON output as an object.
    output = json.loads(bundle.render_json())

    # Run some basic tests
    assert len(output["messages"]) == 1

    print output

    has_ = False

    for message in output["messages"]:
        print message

        if message["type"] == "notice":
            has_ = True

    assert has_
    assert not bundle.failed()
    assert not bundle.failed(True)
开发者ID:kmaglione,项目名称:amo-validator,代码行数:29,代码来源:test_errorbundler.py

示例4: _do_test

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import failed [as 别名]
def _do_test(path, test, failure=True,
             require_install=False, set_type=0):
    
    package_data = open(path, "rb")
    package = XPIManager(package_data, path)
    contents = package.get_file_data()
    err = ErrorBundle()
    
    # Populate in the dependencies.
    if set_type:
        err.set_type(set_type) # Conduit test requires type
    if require_install:
        err.save_resource("has_install_rdf", True)
        rdf_data = package.read("install.rdf")
        install_rdf = RDFParser(rdf_data)
        err.save_resource("install_rdf", install_rdf)
    
    test(err, contents, package)
    
    print err.print_summary(verbose=True)
    
    if failure:
        assert err.failed()
    else:
        assert not err.failed()
    
    return err
开发者ID:nmaier,项目名称:amo-validator,代码行数:29,代码来源:helper.py

示例5: _do_test

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import failed [as 别名]
def _do_test(path, test, failure=True,
             require_install=False, set_type=0,
             listed=False, xpi_mode="r"):

    package_data = open(path, "rb")
    package = XPIManager(package_data, mode=xpi_mode, name=path)
    err = ErrorBundle()
    if listed:
        err.save_resource("listed", True)

    # Populate in the dependencies.
    if set_type:
        err.detected_type = set_type # Conduit test requires type
    if require_install:
        err.save_resource("has_install_rdf", True)
        rdf_data = package.read("install.rdf")
        install_rdf = RDFParser(err, rdf_data)
        err.save_resource("install_rdf", install_rdf)

    populate_chrome_manifest(err, package)

    test(err, package)

    print err.print_summary(verbose=True)

    if failure:
        assert err.failed()
    else:
        assert not err.failed()

    return err
开发者ID:dimonov,项目名称:amo-validator,代码行数:33,代码来源:helper.py

示例6: test_results_aggregator

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import failed [as 别名]
def test_results_aggregator():
    'Tests that language pack aggregation results are read properly.'

    err = ErrorBundle()
    l10n._aggregate_results(err,
                            [{'type':'missing_files',
                              'filename':'foo.bar'}],
                            {'name': 'en-US',
                             'target': 'foo.bar',
                             'jarred': False})
    assert err.failed()

    err = ErrorBundle()
    l10n._aggregate_results(err,
                            [{'type':'missing_entities',
                              'filename':'foo.bar',
                              'missing_entities':['asdf','ghjk']}],
                            {'name': 'en-US',
                             'target': 'foo.bar',
                             'jarred': False})
    assert err.failed()

    err = ErrorBundle()
    l10n._aggregate_results(err,
                            [{'type':'unchanged_entity',
                              'entities':0,
                              'unchanged_entities':[('asdf', 1), ('ghjk', 1)],
                              'filename':'foo.bar'},
                              {'type':'total_entities',
                               'entities':100}],
                            {'name': 'en-US',
                             'target': 'foo.bar',
                             'jarred': False})
    assert not err.failed()

    err = ErrorBundle()
    l10n._aggregate_results(err,
                            [{'type':'unchanged_entity',
                              'entities':50,
                              'unchanged_entities':[('asdf', 1), ('ghjk', 1)],
                              'filename':'foo.bar'},
                             {'type':'file_entity_count',
                              'filename':'foo.bar',
                              'entities':100},
                             {'type':'total_entities',
                              'entities':100}],
                            {'name': 'en-US',
                             'target': 'foo.bar',
                             'path': '/locale/en-US/',
                             'jarred': True})
    assert not err.failed()
    assert err.notices
    print err.notices
    assert all('//' not in ''.join(m['file']) for m in err.warnings)
开发者ID:AutomatedTester,项目名称:amo-validator,代码行数:56,代码来源:test_l10n_langpack.py

示例7: test_valid_chrome_manifest

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import failed [as 别名]
def test_valid_chrome_manifest():
    'Chrome manifests must only contain certain elements'

    err = ErrorBundle()
    err.save_resource('chrome.manifest', chrome_manifest('locale foo bar'))
    langpack.test_langpack_manifest(err, MockXPI())
    assert not err.failed()

    err.save_resource('chrome.manifest', chrome_manifest('foo bar asdf'))
    langpack.test_langpack_manifest(err, MockXPI())
    assert err.failed()
开发者ID:kmaglione,项目名称:amo-validator,代码行数:13,代码来源:test_langpack.py

示例8: _test_value

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import failed [as 别名]
def _test_value(value, test, failure=True):
    "Tests a value against a test."

    err = ErrorBundle()

    test(err, value)

    if failure:
        return err.failed()
    else:
        return not err.failed()
开发者ID:andymckay,项目名称:amo-validator,代码行数:13,代码来源:test_installrdf.py

示例9: _do_test

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import failed [as 别名]
def _do_test(url, failure=True, listed=False):
    err = ErrorBundle()
    results = detect_opensearch(err, open(url), listed=listed)

    if results.failed():
        print results.print_summary()

    if failure:
        assert err.failed()
    else:
        assert not err.failed()
开发者ID:Rob--W,项目名称:amo-validator,代码行数:13,代码来源:test_opensearch.py

示例10: test_valid_chrome_manifest

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import failed [as 别名]
def test_valid_chrome_manifest():
    "Chrome manifests must only contain certain elements"

    err = ErrorBundle()
    err.save_resource("chrome.manifest", ChromeManifest("locale foo bar", ""))
    langpack.test_langpack_manifest(err, MockXPI())
    assert not err.failed()

    err.save_resource("chrome.manifest", ChromeManifest("foo bar asdf", ""))
    langpack.test_langpack_manifest(err, MockXPI())
    assert err.failed()
开发者ID:clouserw,项目名称:amo-validator,代码行数:13,代码来源:test_langpack.py

示例11: test_no_chromemanifest

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import failed [as 别名]
def test_no_chromemanifest():
    """
    Chrome manifest tests should not be run if there is no chrome manifest.
    """
    err = ErrorBundle()
    assert tc_chromemanifest.test_categories(err) is None
    assert not err.failed()

    err = ErrorBundle()
    assert tc_chromemanifest.test_resourcemodules(err) is None
    assert not err.failed()
开发者ID:myrdd,项目名称:amo-validator,代码行数:13,代码来源:test_chromemanifest_testcases.py

示例12: test_scripting_snippet

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import failed [as 别名]
def test_scripting_snippet():
    'Assert that JS snippets are treated equally.'

    err = ErrorBundle()
    err.supported_versions = {}
    scripting.test_js_snippet(err, 'alert(1 + 1 == 2)', 'bar.zap')
    assert not err.failed()

    err = ErrorBundle()
    err.supported_versions = {}
    scripting.test_js_snippet(err, "eval('foo');", 'bar.zap')
    assert err.failed()
开发者ID:diox,项目名称:amo-validator,代码行数:14,代码来源:test_js_spidermonkey.py

示例13: test_webapp_installs_allowed_from_missing_listed

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import failed [as 别名]
def test_webapp_installs_allowed_from_missing_listed():
    """Test that installs_allowed_from is present when listed.."""

    err = ErrorBundle(listed=False)
    data = _get_json()
    del data["installs_allowed_from"]
    _detect(err, data)
    assert not err.failed()

    err = ErrorBundle(listed=True)
    _detect(err, data)
    assert err.failed()
开发者ID:fox2mike,项目名称:amo-validator,代码行数:14,代码来源:test_webapp.py

示例14: test_scripting_snippet

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import failed [as 别名]
def test_scripting_snippet():
    "Asserts that JS snippets are treated equally"

    err = ErrorBundle()
    err.supported_versions = {}
    scripting.test_js_snippet(err, "alert(1 + 1 == 2)", "bar.zap")
    assert not err.failed()

    err = ErrorBundle()
    err.supported_versions = {}
    scripting.test_js_snippet(err, "eval('foo');", "bar.zap")
    assert err.failed()
开发者ID:l-hedgehog,项目名称:amo-validator,代码行数:14,代码来源:test_js_spidermonkey.py

示例15: test_prepare_package_xml

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import failed [as 别名]
def test_prepare_package_xml(test_search):
    'Tests that the prepare_package function passes with search providers'

    err = ErrorBundle()
    submain.prepare_package(err, 'tests/resources/main/foo.xml')

    assert not err.failed()
    assert test_search.called

    test_search.side_effect = lambda err, *args: err.error(('x'), 'Failed')
    submain.prepare_package(err, 'tests/resources/main/foo.xml')

    assert err.failed()
开发者ID:AutomatedTester,项目名称:amo-validator,代码行数:15,代码来源:test_submain.py


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