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


Python proofreadpage.ProofreadPage类代码示例

本文整理汇总了Python中pywikibot.proofreadpage.ProofreadPage的典型用法代码示例。如果您正苦于以下问题:Python ProofreadPage类的具体用法?Python ProofreadPage怎么用?Python ProofreadPage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: test_index

    def test_index(self):
        """Test index property."""
        # Page with Index.
        page = ProofreadPage(self.site, self.valid['title'])
        index_page = IndexPage(self.site, self.valid['index'])

        # Test propery.
        self.assertEqual(page.index, index_page)

        # Test deleter
        del page.index
        self.assertFalse(hasattr(page, '_index'))
        # Test setter
        page.index = index_page
        self.assertEqual(page.index, index_page)

        # Page without Index.
        page = ProofreadPage(self.site, self.existing_multilinked['title'])
        index_page_1 = IndexPage(self.site, self.existing_multilinked['index_1'])
        index_page_2 = IndexPage(self.site, self.existing_multilinked['index_2'])
        self.assertEqual(page.index, index_page_1)
        self.assertNotEqual(page.index, index_page_2)
        self.assertEqual(page._index, (index_page_1, [index_page_2]))

        # Page without Index.
        page = ProofreadPage(self.site, self.existing_unlinked['title'])
        self.assertIs(page.index, None)
        self.assertEqual(page._index, (None, []))
开发者ID:PersianWikipedia,项目名称:pywikibot-core,代码行数:28,代码来源:proofreadpage_tests.py

示例2: test_invalid_not_existing_page_source

 def test_invalid_not_existing_page_source(self):
     """Test ProofreadPage from invalid not existing Page as source."""
     # namespace is forced
     source = pywikibot.Page(self.site, self.not_existing_invalid["title"])
     fixed_source = pywikibot.Page(self.site, source.title(withNamespace=False), ns=self.site.proofread_page_ns)
     page = ProofreadPage(fixed_source)
     self.assertEqual(page.title(), fixed_source.title())
开发者ID:Annie201,项目名称:pywikibot-core,代码行数:7,代码来源:proofreadpage_tests.py

示例3: gen

 def gen(self):
     """Generate pages from specified page interval."""
     for page_number in self.page_number_gen():
         title = '{prefix}/{number}'.format(prefix=self._prefix,
                                            number=page_number)
         page = ProofreadPage(self._index.site, title)
         page.page_number = page_number  # remember page number in djvu file
         yield page
开发者ID:xZise,项目名称:pywikibot-core,代码行数:8,代码来源:djvutext.py

示例4: test_preload_from_empty_text

 def test_preload_from_empty_text(self):
     """Test ProofreadPage page decomposing/composing text."""
     page = ProofreadPage(self.site, 'dummy test page')
     page.text = ''
     self.assertEqual(page.text,
                      '<noinclude><pagequality level="1" user="" />'
                      '<div class="pagetext">\n\n\n</noinclude>'
                      '<noinclude></div></noinclude>')
开发者ID:edgarskos,项目名称:pywikibot_scripts,代码行数:8,代码来源:proofreadpage_tests.py

示例5: test_valid_link_source

 def test_valid_link_source(self):
     """Test ProofreadPage from valid Link as source."""
     source = pywikibot.Link(
         self.valid['title'],
         source=self.site,
         defaultNamespace=self.site.proofread_page_ns)
     page = ProofreadPage(source)
     self.assertEqual(page.title(withNamespace=False), source.title)
     self.assertEqual(page.namespace(), source.namespace)
开发者ID:PersianWikipedia,项目名称:pywikibot-core,代码行数:9,代码来源:proofreadpage_tests.py

示例6: test_preload_from_empty_text

 def test_preload_from_empty_text(self):
     """Test ProofreadPage page decomposing/composing text."""
     page = ProofreadPage(self.site, 'Page:dummy test page')
     page.text = ''
     class_pagetext, div = self.class_pagetext_fmt[page._full_header._has_div]
     self.assertEqual(page.text,
                      self.fmt.format(user=self.site.username(),
                                      class_pagetext=class_pagetext,
                                      references='',
                                      div_end=div))
开发者ID:PersianWikipedia,项目名称:pywikibot-core,代码行数:10,代码来源:proofreadpage_tests.py

示例7: test_json_format

    def test_json_format(self):
        """Test conversion to json format."""
        page = ProofreadPage(self.site, self.valid["title"])

        rvargs = {
            "rvprop": "ids|flags|timestamp|user|comment|content",
            "rvcontentformat": "application/json",
            "titles": page,
        }

        rvgen = self.site._generator(api.PropertyGenerator, type_arg="info|revisions", total=1, **rvargs)
        rvgen.set_maximum_items(-1)  # suppress use of rvlimit parameter

        try:
            pagedict = next(iter(rvgen))
            loaded_text = pagedict.get("revisions")[0].get("*")
        except (StopIteration, TypeError, KeyError, ValueError, IndexError):
            page_text = ""

        page_text = page._page_to_json()
        self.assertEqual(json.loads(page_text), json.loads(loaded_text))
开发者ID:Annie201,项目名称:pywikibot-core,代码行数:21,代码来源:proofreadpage_tests.py

示例8: test_valid_site_source

 def test_valid_site_source(self):
     """Test ProofreadPage from valid Site as source."""
     page = ProofreadPage(self.site, 'Page:dummy test page')
     self.assertEqual(page.namespace(), self.site.proofread_page_ns)
开发者ID:PersianWikipedia,项目名称:pywikibot-core,代码行数:4,代码来源:proofreadpage_tests.py


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