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


Python ErrorBundle.supported_versions方法代码示例

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


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

示例1: test_scripting_snippet

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import supported_versions [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

示例2: test_scripting_snippet

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import supported_versions [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

示例3: test_packed_scripts_pollution

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import supported_versions [as 别名]
def test_packed_scripts_pollution():
    """Test that packed scripts test for pollution properly."""

    x = MockXPI({'foo/bar.js': 'tests/resources/content/pollution_error.js'})

    err = ErrorBundle()
    err.supported_versions = {}

    c = chrome_manifest('content ns jar:subpackage.jar!/')

    err.save_resource('chrome.manifest_nopush', c, pushable=False)

    err.save_resource(
        'scripts',
        [{'scripts': ['foo/bar.js'],
          'package': x,
          'state': ['subpackage.jar', 'subsubpackage']}])
    err.save_resource('marked_scripts', set(['chrome://ns/foo/bar.js']))

    content.test_packed_scripts(err, x)

    eq_(err.package_stack, [])

    assert err.failed()
    assert err.warnings
    assert not err.errors

    eq_(err.warnings[0]['file'],
        ['subpackage.jar', 'subsubpackage', 'foo/bar.js'])
开发者ID:kmaglione,项目名称:amo-validator,代码行数:31,代码来源:test_content_scripts.py

示例4: test_packed_scripts_no_pollution

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import supported_versions [as 别名]
def test_packed_scripts_no_pollution():
    """
    Test that packed scripts test for pollution without being overzealous.
    """

    x = MockXPI({'foo/bar.js': 'tests/resources/content/pollution_error.js'})

    err = ErrorBundle()
    err.supported_versions = {}

    c = ChromeManifest("""
    content ns jar:subpackage.jar!/
    """, 'chrome.manifest')

    err.save_resource('chrome.manifest_nopush', c, pushable=False)

    err.save_resource(
        'scripts',
        [{'scripts': ['foo/bar.js'],
          'package': x,
          'state': ['subpackage', 'subsubpackage']}])
    err.save_resource('marked_scripts', set(['chrome://otherns/foo/bar.js']))

    content.test_packed_scripts(err, x)

    assert err.package_stack == []

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

示例5: test_marking_overlays

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import supported_versions [as 别名]
def test_marking_overlays():
    """
    Mark an overlay, then test that it marks the scripts within the overlay.
    """

    err = ErrorBundle()
    err.supported_versions = {}
    c = ChromeManifest("""
    content ns1 foo/
    overlay chrome://foo chrome://ns1/content/main.xul
    """, "chrome.manifest")
    err.save_resource("chrome.manifest", c)
    err.save_resource("chrome.manifest_nopush", c)

    xpi = MockXPI({"foo/main.xul": "tests/resources/content/script_list.xul"})

    content.test_packed_packages(err, xpi)
    assert not err.failed()

    marked_scripts = err.get_resource("marked_scripts")
    print marked_scripts
    assert marked_scripts

    eq_(marked_scripts, set(["chrome://ns1/foo.js",
                             "chrome://ns1/bar.js",
                             "chrome://asdf/foo.js"]))
开发者ID:Archaeopteryx,项目名称:amo-validator,代码行数:28,代码来源:test_content_overlays.py

示例6: test_packed_scripts_pollution

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import supported_versions [as 别名]
def test_packed_scripts_pollution():
    """Test that packed scripts test for pollution properly."""

    x = MockXPI({"foo/bar.js": "tests/resources/content/pollution_error.js"})

    err = ErrorBundle()
    err.supported_versions = {}

    c = ChromeManifest("""
    content ns jar:subpackage.jar!/
    """, "chrome.manifest")

    err.save_resource("chrome.manifest_nopush", c, pushable=False)

    err.save_resource(
        "scripts",
        [{"scripts": ["foo/bar.js"],
          "package": x,
          "state": ["subpackage.jar", "subsubpackage"]}])
    err.save_resource("marked_scripts", set(["chrome://ns/foo/bar.js"]))

    content.test_packed_scripts(err, x)

    eq_(err.package_stack, [])

    assert err.failed()
    assert err.warnings
    assert not err.errors
开发者ID:clouserw,项目名称:amo-validator,代码行数:30,代码来源:test_content_scripts.py

示例7: _test

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import supported_versions [as 别名]
def _test(script):
    err = ErrorBundle()
    err.supported_versions = {}
    err.save_resource('em:bootstrap', 'true')
    scripting.test_js_file(err, 'foo', script)

    return err
开发者ID:AutomatedTester,项目名称:amo-validator,代码行数:9,代码来源:test_js_bootstrapped.py

示例8: test_version_forappversions_accepted

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import supported_versions [as 别名]
def test_version_forappversions_accepted():
    """
    Test that for_appversions targets application versions properly.
    """

    err = ErrorBundle()
    err.supported_versions = {'firefox': ['1.2.3']}

    tests = decorator.TEST_TIERS
    decorator.TEST_TIERS = {}

    @decorator.register_test(tier=5, versions={'firefox': ['1.0.0',
                                                           '1.2.3']})
    def version_test(err, xpi):
        print 'Ran test'
        err.save_resource('executed', True)

    print decorator.TEST_TIERS

    validator.submain.test_inner_package(err, MockXPI(),
                                         for_appversions={'firefox':
                                                              ['1.2.3']})

    assert err.get_resource('executed')
    decorator.TEST_TIERS = tests
开发者ID:AutomatedTester,项目名称:amo-validator,代码行数:27,代码来源:test_submain_versions.py

示例9: test_marking_overlays_subdir

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import supported_versions [as 别名]
def test_marking_overlays_subdir():
    """
    Mark an overlay in a subdirectory, then test that it marks the scripts
    within the overlay. Make sure it properly figures out relative URLs.
    """

    err = ErrorBundle()
    err.supported_versions = {}
    c = ChromeManifest("""
    content ns1 foo/
    overlay chrome://foo chrome://ns1/content/subdir/main.xul
    """, 'chrome.manifest')
    err.save_resource('chrome.manifest', c)
    err.save_resource('chrome.manifest_nopush', c)

    xpi = MockXPI({'foo/subdir/main.xul':
                       'tests/resources/content/script_list.xul'})

    content.test_packed_packages(err, xpi)
    assert not err.failed()

    marked_scripts = err.get_resource('marked_scripts')
    print marked_scripts
    assert marked_scripts

    eq_(marked_scripts, set(['chrome://ns1/subdir/foo.js', 'chrome://ns1/bar.js',
                             'chrome://asdf/foo.js']))
开发者ID:diox,项目名称:amo-validator,代码行数:29,代码来源:test_content_overlays.py

示例10: test_structure

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import supported_versions [as 别名]
 def test_structure(structure):
     err = ErrorBundle()
     err.supported_versions = {}
     mock_package = MockXPI(structure)
     content.test_packed_packages(err, mock_package)
     print err.print_summary(verbose=True)
     assert err.failed()
开发者ID:l-hedgehog,项目名称:amo-validator,代码行数:9,代码来源:test_content.py

示例11: test_jar_subpackage

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import supported_versions [as 别名]
def test_jar_subpackage():
    "Tests JAR files that are subpackages."

    err = ErrorBundle()
    err.set_type(PACKAGE_EXTENSION)
    err.supported_versions = {"foo": ["1.2.3"]}
    mock_package = MockXPI(
        {"chrome/subpackage.jar":
             "tests/resources/content/subpackage.jar",
         "subpackage.jar":
             "tests/resources/content/subpackage.jar"})

    content.testendpoint_validator = \
        MockTestEndpoint(("test_inner_package", ))

    result = content.test_packed_packages(
                                    err,
                                    mock_package)
    print result
    assert result == 2
    content.testendpoint_validator.assert_expectation(
                                    "test_inner_package",
                                    2)
    content.testendpoint_validator.assert_expectation(
                                    "test_inner_package",
                                    2,
                                    "subpackage")
    assert err.supported_versions == {"foo": ["1.2.3"]}
开发者ID:malyshkosergey,项目名称:amo-validator,代码行数:30,代码来源:test_content.py

示例12: _do_test

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import supported_versions [as 别名]
def _do_test(path):
    script = validator.unicodehelper.decode(open(path, 'rb').read())
    print script.encode('ascii', 'replace')

    err = ErrorBundle(instant=True)
    err.supported_versions = {}
    err.handler = OutputHandler(sys.stdout, False)
    validator.testcases.scripting.test_js_file(err, path, script)
    return err
开发者ID:AutomatedTester,项目名称:amo-validator,代码行数:11,代码来源:test_controlchars.py

示例13: test_hidden_files

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import supported_versions [as 别名]
def test_hidden_files(test_input):
    """Tests that hidden files are reported."""

    err = ErrorBundle()
    err.supported_versions = {}
    mock_package = MockXPI(test_input)
    content.test_packed_packages(err, mock_package)
    print err.print_summary(verbose=True)
    assert err.failed()
开发者ID:AutomatedTester,项目名称:amo-validator,代码行数:11,代码来源:test_content.py

示例14: test

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import supported_versions [as 别名]
 def test(versions):
     err = ErrorBundle()
     err.supported_versions = versions
     parser = MarkupParser(err)
     parser.process(name,
                    data,
                    name.split(".")[-1])
     print err.print_summary(verbose=True)
     assert not err.failed()
     return err
开发者ID:malyshkosergey,项目名称:amo-validator,代码行数:12,代码来源:test_compatibility.py

示例15: test_packed_scripts_ignored_no_scripts

# 需要导入模块: from validator.errorbundler import ErrorBundle [as 别名]
# 或者: from validator.errorbundler.ErrorBundle import supported_versions [as 别名]
def test_packed_scripts_ignored_no_scripts():
    """Test that packed scripts are not tested when there are no scripts."""

    x = MockXPI({'foo.js': 'tests/resources/content/one_error.js'})

    err = ErrorBundle()
    err.supported_versions = {}

    content.test_packed_scripts(err, x)
    assert not err.failed()
开发者ID:kmaglione,项目名称:amo-validator,代码行数:12,代码来源:test_content_scripts.py


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