本文整理汇总了Python中validator.chromemanifest.ChromeManifest.get_objects方法的典型用法代码示例。如果您正苦于以下问题:Python ChromeManifest.get_objects方法的具体用法?Python ChromeManifest.get_objects怎么用?Python ChromeManifest.get_objects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类validator.chromemanifest.ChromeManifest
的用法示例。
在下文中一共展示了ChromeManifest.get_objects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_open
# 需要导入模块: from validator.chromemanifest import ChromeManifest [as 别名]
# 或者: from validator.chromemanifest.ChromeManifest import get_objects [as 别名]
def test_open():
"""Open a chrome file and ensure that data can be pulled from it."""
chrome = open("tests/resources/chromemanifest/chrome.manifest")
chrome_data = chrome.read()
manifest = ChromeManifest(chrome_data, "chrome.manifest")
assert manifest is not None
assert manifest.get_value("locale", "basta")["object"] == "resource"
g_obj = list(manifest.get_objects("subject", "predicate"))
assert len(g_obj) == 1
assert g_obj[0] == "object"
obj_resource = list(manifest.get_triples(None, None, "resource"))
assert len(obj_resource) == 2
pred_pred = list(manifest.get_triples(None, "predicate", None))
assert len(pred_pred) == 2
sub_locale = list(manifest.get_triples("locale", None, None))
assert len(sub_locale) == 2