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


Python ChromeManifest.reverse_lookup方法代码示例

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


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

示例1: test_reverse_lookup

# 需要导入模块: from validator.chromemanifest import ChromeManifest [as 别名]
# 或者: from validator.chromemanifest.ChromeManifest import reverse_lookup [as 别名]
def test_reverse_lookup():
    """Test that the chrome reverse lookup function works properly."""

    c = ChromeManifest("""
    content ns1 /dir1/
    content ns2 /dir2/foo/
    content nsbad1 /dir3
    content ns3 jar:foo.jar!/subdir1/
    content ns3 jar:zap.jar!/altdir1/
    content ns4 jar:bar.jar!/subdir2
    """, "chrome.manifest")

    eq_(c.reverse_lookup(MockPackStack(), "random.js"), None)
    eq_(c.reverse_lookup(MockPackStack(), "/dir1/x.js"),
        "chrome://ns1/x.js")
    eq_(c.reverse_lookup(MockPackStack(), "/dir2/x.js"), None)
    eq_(c.reverse_lookup(MockPackStack(), "/dir2/foo/x.js"),
        "chrome://ns2/x.js")
    eq_(c.reverse_lookup(MockPackStack(), "/dir3/x.js"),
        "chrome://nsbad1/x.js")
    eq_(c.reverse_lookup(MockPackStack(["foo.jar"]), "/x.js"),
        "chrome://ns3/subdir1/x.js")
    eq_(c.reverse_lookup(MockPackStack(["foo.jar"]), "/zap/x.js"),
        "chrome://ns3/subdir1/zap/x.js")
    eq_(c.reverse_lookup(MockPackStack(["bar.jar"]), "/x.js"),
        "chrome://ns4/subdir2/x.js")
    eq_(c.reverse_lookup(MockPackStack(["zap.jar"]), "/x.js"),
        "chrome://ns3/altdir1/x.js")
开发者ID:clouserw,项目名称:amo-validator,代码行数:30,代码来源:test_chromemanifest.py

示例2: test_reverse_lookup

# 需要导入模块: from validator.chromemanifest import ChromeManifest [as 别名]
# 或者: from validator.chromemanifest.ChromeManifest import reverse_lookup [as 别名]
def test_reverse_lookup():
    """Test that the chrome reverse lookup function works properly."""

    c = ChromeManifest("""
    content ns1 /dir1/
    content ns2 /dir2/foo/
    content nsbad1 /dir3
    content ns3 jar:foo.jar!/subdir1/
    content ns3 jar:zap.jar!/altdir1/
    content ns4 jar:bar.jar!/subdir2
    """, 'chrome.manifest')

    assert c.reverse_lookup(MockPackStack(), 'random.js') is None
    assert c.reverse_lookup(MockPackStack(),
                            '/dir1/x.js') == 'chrome://ns1/x.js'
    assert c.reverse_lookup(MockPackStack(), '/dir2/x.js') is None
    assert c.reverse_lookup(MockPackStack(),
                            '/dir2/foo/x.js') == 'chrome://ns2/x.js'
    assert c.reverse_lookup(MockPackStack(),
                            '/dir3/x.js') == 'chrome://nsbad1/x.js'
    assert c.reverse_lookup(MockPackStack(['foo.jar']),
                            '/x.js') == 'chrome://ns3/subdir1/x.js'
    assert c.reverse_lookup(MockPackStack(['foo.jar']),
                            '/zap/x.js') == 'chrome://ns3/subdir1/zap/x.js'
    assert c.reverse_lookup(MockPackStack(['bar.jar']),
                            '/x.js') == 'chrome://ns4/subdir2/x.js'
    assert c.reverse_lookup(MockPackStack(['zap.jar']),
                            '/x.js') == 'chrome://ns3/altdir1/x.js'
开发者ID:AutomatedTester,项目名称:amo-validator,代码行数:30,代码来源:test_chromemanifest.py


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