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


Python ScrapedViewFeature.load_feature方法代码示例

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


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

示例1: test_load_compat_table_existing_resources

# 需要导入模块: from mdn.scrape import ScrapedViewFeature [as 别名]
# 或者: from mdn.scrape.ScrapedViewFeature import load_feature [as 别名]
 def test_load_compat_table_existing_resources(self):
     version = self.get_instance("Version", ("firefox_desktop", "1.0"))
     browser = version.browser
     feature = self.get_instance("Feature", "web-css-background-size-contain_and_cover")
     support = self.create(Support, version=version, feature=feature)
     browser_id = str(browser.id)
     version_id = str(version.id)
     feature_id = str(feature.id)
     support_id = str(support.id)
     scraped_data = self.empty_scrape()
     scraped_table = {
         "name": "desktop",
         "browsers": [{"id": browser_id, "name": browser.name["en"], "slug": browser.slug}],
         "versions": [{"id": version_id, "browser": browser_id, "version": "1.0"}],
         "features": [{"id": feature_id, "name": feature.name["en"], "slug": feature.slug}],
         "supports": [{"id": support_id, "feature": feature_id, "version": version_id, "support": "yes"}],
     }
     scraped_data["compat"].append(scraped_table)
     view = ScrapedViewFeature(self.page, scraped_data)
     out = view.generate_data()
     expected = self.empty_view(scraped_data)
     expected["linked"]["browsers"].append(view.load_browser(browser.id))
     expected["linked"]["versions"].append(view.load_version(version.id))
     expected["linked"]["features"].append(view.load_feature(feature.id))
     expected["linked"]["supports"].append(view.load_support(support.id))
     expected["meta"]["compat_table"]["supports"][feature_id] = {browser_id: [support_id]}
     expected["meta"]["compat_table"]["tabs"].append({"name": {"en": "Desktop Browsers"}, "browsers": [browser_id]})
     self.assertDataEqual(expected, out)
开发者ID:renoirb,项目名称:browsercompat,代码行数:30,代码来源:test_scrape.py

示例2: test_load_feature_canonical_name

# 需要导入模块: from mdn.scrape import ScrapedViewFeature [as 别名]
# 或者: from mdn.scrape.ScrapedViewFeature import load_feature [as 别名]
 def test_load_feature_canonical_name(self):
     feature = self.create(
         Feature, slug='web-css-background-size_list-item',
         name={'zxx': 'list-item'}, parent=self.feature)
     view = ScrapedViewFeature(self.page, self.empty_scrape())
     feature_content = view.load_feature(feature.id)
     expected = {
         'id': str(feature.id), 'name': 'list-item',
         'slug': feature.slug, 'mdn_uri': None, 'obsolete': False,
         'stable': True, 'standardized': True, 'experimental': False,
         'links': {
             'children': [], 'parent': str(self.feature.id),
             'references': [], 'supports': []}}
     self.assertDataEqual(expected, feature_content)
开发者ID:MatonAnthony,项目名称:browsercompat,代码行数:16,代码来源:test_scrape.py

示例3: test_load_feature

# 需要导入模块: from mdn.scrape import ScrapedViewFeature [as 别名]
# 或者: from mdn.scrape.ScrapedViewFeature import load_feature [as 别名]
 def test_load_feature(self):
     feature = self.get_instance(
         'Feature', 'web-css-background-size-contain_and_cover')
     view = ScrapedViewFeature(self.page, self.empty_scrape())
     feature_content = view.load_feature(feature.id)
     expected = {
         'id': str(feature.id),
         'name': {'en': '<code>contain</code> and <code>cover</code>'},
         'slug': feature.slug, 'mdn_uri': None, 'obsolete': False,
         'stable': True, 'standardized': True, 'experimental': False,
         'links': {
             'children': [], 'parent': str(self.feature.id),
             'references': [], 'supports': []}}
     self.assertDataEqual(expected, feature_content)
开发者ID:MatonAnthony,项目名称:browsercompat,代码行数:16,代码来源:test_scrape.py

示例4: test_load_feature

# 需要导入模块: from mdn.scrape import ScrapedViewFeature [as 别名]
# 或者: from mdn.scrape.ScrapedViewFeature import load_feature [as 别名]
 def test_load_feature(self):
     feature = self.get_instance("Feature", "web-css-background-size-contain_and_cover")
     view = ScrapedViewFeature(self.page, self.empty_scrape())
     feature_content = view.load_feature(feature.id)
     expected = {
         "id": str(feature.id),
         "name": {"en": "<code>contain</code> and <code>cover</code>"},
         "slug": feature.slug,
         "mdn_uri": None,
         "obsolete": False,
         "stable": True,
         "standardized": True,
         "experimental": False,
         "links": {"children": [], "parent": str(self.feature.id), "sections": [], "supports": []},
     }
     self.assertDataEqual(expected, feature_content)
开发者ID:renoirb,项目名称:browsercompat,代码行数:18,代码来源:test_scrape.py

示例5: test_load_feature_canonical_name

# 需要导入模块: from mdn.scrape import ScrapedViewFeature [as 别名]
# 或者: from mdn.scrape.ScrapedViewFeature import load_feature [as 别名]
 def test_load_feature_canonical_name(self):
     feature = self.create(
         Feature, slug="web-css-background-size_list-item", name={"zxx": "list-item"}, parent=self.feature
     )
     view = ScrapedViewFeature(self.page, self.empty_scrape())
     feature_content = view.load_feature(feature.id)
     expected = {
         "id": str(feature.id),
         "name": "list-item",
         "slug": feature.slug,
         "mdn_uri": None,
         "obsolete": False,
         "stable": True,
         "standardized": True,
         "experimental": False,
         "links": {"children": [], "parent": str(self.feature.id), "sections": [], "supports": []},
     }
     self.assertDataEqual(expected, feature_content)
开发者ID:renoirb,项目名称:browsercompat,代码行数:20,代码来源:test_scrape.py

示例6: test_load_compat_table_existing_resources

# 需要导入模块: from mdn.scrape import ScrapedViewFeature [as 别名]
# 或者: from mdn.scrape.ScrapedViewFeature import load_feature [as 别名]
 def test_load_compat_table_existing_resources(self):
     version = self.get_instance('Version', ('firefox_desktop', '1.0'))
     browser = version.browser
     feature = self.get_instance(
         'Feature', 'web-css-background-size-contain_and_cover')
     support = self.create(Support, version=version, feature=feature)
     browser_id = str(browser.id)
     version_id = str(version.id)
     feature_id = str(feature.id)
     support_id = str(support.id)
     scraped_data = self.empty_scrape()
     scraped_table = {
         'name': 'desktop',
         'browsers': [{
             'id': browser_id, 'name': browser.name['en'],
             'slug': browser.slug}],
         'versions': [{
             'id': version_id, 'browser': browser_id, 'version': '1.0'}],
         'features': [{
             'id': feature_id, 'name': feature.name['en'],
             'slug': feature.slug}],
         'supports': [{
             'id': support_id, 'feature': feature_id, 'version': version_id,
             'support': 'yes'}]}
     scraped_data['compat'].append(scraped_table)
     view = ScrapedViewFeature(self.page, scraped_data)
     out = view.generate_data()
     expected = self.empty_view(scraped_data)
     expected['features']['links']['children'] = [feature_id]
     expected['linked']['browsers'].append(view.load_browser(browser.id))
     expected['linked']['versions'].append(view.load_version(version.id))
     expected['linked']['features'].append(view.load_feature(feature.id))
     expected['linked']['supports'].append(view.load_support(support.id))
     expected['meta']['compat_table']['supports'][feature_id] = {
         browser_id: [support_id]}
     expected['meta']['compat_table']['tabs'].append({
         'name': {'en': 'Desktop Browsers'},
         'browsers': [browser_id]})
     self.assertDataEqual(expected, out)
开发者ID:MatonAnthony,项目名称:browsercompat,代码行数:41,代码来源:test_scrape.py


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