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


Python ScrapedViewFeature.new_specification方法代码示例

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


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

示例1: test_load_specification_row_empty_resources

# 需要导入模块: from mdn.scrape import ScrapedViewFeature [as 别名]
# 或者: from mdn.scrape.ScrapedViewFeature import new_specification [as 别名]
 def test_load_specification_row_empty_resources(self):
     scraped_data = self.empty_scrape()
     scraped_spec = {
         'section.note': '',
         'section.subpath': '',
         'section.name': '',
         'specification.mdn_key': 'CSS3 UI',
         'section.id': None,
         'specification.id': None}
     scraped_data['specs'].append(scraped_spec)
     view = ScrapedViewFeature(self.page, scraped_data)
     out = view.generate_data()
     spec_content, mat_content = view.new_specification(scraped_spec)
     section_content = view.new_section(scraped_spec, spec_content['id'])
     # TODO: bug 1251252 - Empty string should mean omittied name, subpath
     section_content['name']['en'] = ''
     section_content['subpath']['en'] = ''
     reference_content = view.load_or_new_reference(section_content['id'])
     reference_content['note'] = None
     expected = self.empty_view(scraped_data)
     expected['features']['links']['references'] = [reference_content['id']]
     expected['linked']['maturities'] = [mat_content]
     expected['linked']['specifications'] = [spec_content]
     expected['linked']['sections'] = [section_content]
     expected['linked']['references'] = [reference_content]
     self.assertDataEqual(expected, out)
开发者ID:MatonAnthony,项目名称:browsercompat,代码行数:28,代码来源:test_scrape.py

示例2: test_new_specification

# 需要导入模块: from mdn.scrape import ScrapedViewFeature [as 别名]
# 或者: from mdn.scrape.ScrapedViewFeature import new_specification [as 别名]
 def test_new_specification(self):
     spec_row = {
         "section.note": "section note",
         "section.subpath": "#section",
         "section.name": "section",
         "specification.mdn_key": "CSS3 UI",
         "section.id": None,
         "specification.id": None,
     }
     view = ScrapedViewFeature(self.page, self.empty_scrape())
     spec_content, mat_content = view.new_specification(spec_row)
     expected_spec = {"id": "_CSS3 UI", "mdn_key": "CSS3 UI", "links": {"maturity": "_unknown", "sections": []}}
     self.assertDataEqual(expected_spec, spec_content)
     expected_mat = {"id": "_unknown", "slug": "", "name": {"en": "Unknown"}, "links": {"specifications": []}}
     self.assertDataEqual(expected_mat, mat_content)
开发者ID:renoirb,项目名称:browsercompat,代码行数:17,代码来源:test_scrape.py

示例3: test_new_specification

# 需要导入模块: from mdn.scrape import ScrapedViewFeature [as 别名]
# 或者: from mdn.scrape.ScrapedViewFeature import new_specification [as 别名]
 def test_new_specification(self):
     spec_row = {
         'section.note': 'section note',
         'section.subpath': '#section',
         'section.name': 'section',
         'specification.mdn_key': 'CSS3 UI',
         'section.id': None,
         'specification.id': None}
     view = ScrapedViewFeature(self.page, self.empty_scrape())
     spec_content, mat_content = view.new_specification(spec_row)
     expected_spec = {
         'id': '_CSS3 UI', 'mdn_key': 'CSS3 UI',
         'links': {'maturity': '_unknown'}}
     self.assertDataEqual(expected_spec, spec_content)
     expected_mat = {
         'id': '_unknown', 'slug': '', 'name': {'en': 'Unknown'},
         'links': {'specifications': []}}
     self.assertDataEqual(expected_mat, mat_content)
开发者ID:MatonAnthony,项目名称:browsercompat,代码行数:20,代码来源:test_scrape.py

示例4: test_load_specification_row_new_resources

# 需要导入模块: from mdn.scrape import ScrapedViewFeature [as 别名]
# 或者: from mdn.scrape.ScrapedViewFeature import new_specification [as 别名]
 def test_load_specification_row_new_resources(self):
     scraped_data = self.empty_scrape()
     scraped_spec = {
         'section.note': 'section note',
         'section.subpath': '#section',
         'section.name': 'section',
         'specification.mdn_key': 'CSS3 UI',
         'section.id': None,
         'specification.id': None}
     scraped_data['specs'].append(scraped_spec)
     view = ScrapedViewFeature(self.page, scraped_data)
     out = view.generate_data()
     spec_content, mat_content = view.new_specification(scraped_spec)
     section_content = view.new_section(scraped_spec, spec_content['id'])
     expected = self.empty_view(scraped_data)
     expected['features']['links']['sections'] = [section_content['id']]
     expected['linked']['maturities'] = [mat_content]
     expected['linked']['specifications'] = [spec_content]
     expected['linked']['sections'] = [section_content]
     self.assertDataEqual(expected, out)
开发者ID:willkg,项目名称:browsercompat,代码行数:22,代码来源:test_scrape.py

示例5: test_load_specification_row_new_resources

# 需要导入模块: from mdn.scrape import ScrapedViewFeature [as 别名]
# 或者: from mdn.scrape.ScrapedViewFeature import new_specification [as 别名]
 def test_load_specification_row_new_resources(self):
     scraped_data = self.empty_scrape()
     scraped_spec = {
         "section.note": "section note",
         "section.subpath": "#section",
         "section.name": "section",
         "specification.mdn_key": "CSS3 UI",
         "section.id": None,
         "specification.id": None,
     }
     scraped_data["specs"].append(scraped_spec)
     view = ScrapedViewFeature(self.page, scraped_data)
     out = view.generate_data()
     spec_content, mat_content = view.new_specification(scraped_spec)
     section_content = view.new_section(scraped_spec, spec_content["id"])
     expected = self.empty_view(scraped_data)
     expected["features"]["links"]["sections"] = [section_content["id"]]
     expected["linked"]["maturities"] = [mat_content]
     expected["linked"]["specifications"] = [spec_content]
     expected["linked"]["sections"] = [section_content]
     self.assertDataEqual(expected, out)
开发者ID:renoirb,项目名称:browsercompat,代码行数:23,代码来源:test_scrape.py


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