本文整理汇总了Python中tests.join_xml_data_path函数的典型用法代码示例。如果您正苦于以下问题:Python join_xml_data_path函数的具体用法?Python join_xml_data_path怎么用?Python join_xml_data_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了join_xml_data_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_match_any
def test_match_any(self):
"""Test pages with one of many matches."""
template1 = pywikibot.Page(self.site, 'Template:stack begin')
template2 = pywikibot.Page(self.site, 'Template:foobar')
builder = _MultiTemplateMatchBuilder(self.site)
predicate = builder.search_any_predicate([template1, template2])
gen = XMLDumpPageGenerator(
filename=join_xml_data_path('article-pear-0.10.xml'),
site=self.site,
text_predicate=predicate)
pages = list(gen)
self.assertEqual(len(pages), 1)
self.assertPagelistTitles(pages, ['Pear'],
site=self.site)
# reorder templates
predicate = builder.search_any_predicate([template2, template1])
gen = XMLDumpPageGenerator(
filename=join_xml_data_path('article-pear-0.10.xml'),
site=self.site,
text_predicate=predicate)
pages = list(gen)
self.assertEqual(len(pages), 1)
self.assertPagelistTitles(pages, ['Pear'],
site=self.site)
开发者ID:AbdealiJK,项目名称:pywikibot-core,代码行数:26,代码来源:template_bot_tests.py
示例2: test_xml_multiple_namespace_ids_2
def test_xml_multiple_namespace_ids_2(self):
"""Test the generator using multiple namespaces in one parameter."""
main('-xml:' + join_xml_data_path('dummy-reflinks.xml'),
'-namespace:0,1', '-xmlstart:Fake page')
gen = self.constructor_args[0]
self.assertPageTitlesCountEqual(gen, [u'Fake page', u'Talk:Fake page'],
site=self.get_site())
开发者ID:PersianWikipedia,项目名称:pywikibot-core,代码行数:7,代码来源:reflinks_tests.py
示例3: test_xml_namespace_name
def test_xml_namespace_name(self):
"""Test the generator using a namespace name."""
main('-xml:' + join_xml_data_path('dummy-reflinks.xml'),
'-namespace:Talk', '-xmlstart:Fake page')
gen = self.constructor_args[0]
pages = list(gen)
self.assertPagelistTitles(pages, [u'Talk:Fake page'],
site=self.get_site())
开发者ID:PersianWikipedia,项目名称:pywikibot-core,代码行数:8,代码来源:reflinks_tests.py
示例4: test_non_bare_ref_urls
def test_non_bare_ref_urls(self):
"""Test pages without bare references are not processed."""
gen = XmlDumpPageGenerator(
filename=join_xml_data_path('article-pear-0.10.xml'),
start='Pear',
namespaces=[0, 1],
site=self.get_site())
pages = list(gen)
self.assertEqual(len(pages), 0)
开发者ID:PersianWikipedia,项目名称:pywikibot-core,代码行数:9,代码来源:reflinks_tests.py
示例5: test_start_with_underscore
def test_start_with_underscore(self):
"""Test with underscore in start page title."""
gen = XmlDumpPageGenerator(
filename=join_xml_data_path('dummy-reflinks.xml'),
start='Fake_page',
namespaces=[0, 1],
site=self.get_site())
pages = list(gen)
self.assertPagelistTitles(pages, (u'Fake page', u'Talk:Fake page'),
site=self.get_site())
开发者ID:PersianWikipedia,项目名称:pywikibot-core,代码行数:10,代码来源:reflinks_tests.py
示例6: test_namespace_names
def test_namespace_names(self):
"""Test namespaces with namespace names."""
gen = XmlDumpPageGenerator(
filename=join_xml_data_path('dummy-reflinks.xml'),
start='Fake page',
namespaces=["Talk"],
site=self.get_site())
pages = list(gen)
self.assertPagelistTitles(pages, (u'Talk:Fake page', ),
site=self.get_site())
开发者ID:PersianWikipedia,项目名称:pywikibot-core,代码行数:10,代码来源:reflinks_tests.py
示例7: test_namespace_empty_list
def test_namespace_empty_list(self):
"""Test namespaces=[] processes all namespaces."""
gen = XmlDumpPageGenerator(
filename=join_xml_data_path('dummy-reflinks.xml'),
start=u'Fake page',
namespaces=[],
site=self.get_site())
pages = list(gen)
self.assertPagelistTitles(pages, (u'Fake page', u'Talk:Fake page'),
site=self.get_site())
开发者ID:PersianWikipedia,项目名称:pywikibot-core,代码行数:10,代码来源:reflinks_tests.py
示例8: test_simple_bare_refs
def test_simple_bare_refs(self):
"""Test simple bare references in multiple namespaces."""
gen = XmlDumpPageGenerator(
filename=join_xml_data_path('dummy-reflinks.xml'),
start='Fake page',
namespaces=[0, 1],
site=self.get_site())
pages = list(gen)
self.assertPagelistTitles(pages, (u'Fake page', u'Talk:Fake page'),
site=self.get_site())
开发者ID:PersianWikipedia,项目名称:pywikibot-core,代码行数:10,代码来源:reflinks_tests.py
示例9: test_no_match
def test_no_match(self):
"""Test pages without any desired templates."""
template = pywikibot.Page(self.site, 'Template:foobar')
builder = _MultiTemplateMatchBuilder(self.site)
predicate = builder.search_any_predicate([template])
gen = XMLDumpPageGenerator(
filename=join_xml_data_path('article-pear-0.10.xml'),
site=self.site,
text_predicate=predicate)
pages = list(gen)
self.assertEqual(len(pages), 0)
开发者ID:AbdealiJK,项目名称:pywikibot-core,代码行数:11,代码来源:template_bot_tests.py
示例10: test_match_with_params
def test_match_with_params(self):
"""Test pages with one match with parameters."""
template = pywikibot.Page(self.site, 'Template:Taxobox')
builder = _MultiTemplateMatchBuilder(self.site)
predicate = builder.search_any_predicate([template])
gen = XMLDumpPageGenerator(
filename=join_xml_data_path('article-pear-0.10.xml'),
site=self.site,
text_predicate=predicate)
pages = list(gen)
self.assertEqual(len(pages), 1)
self.assertPagelistTitles(pages, ['Pear'],
site=self.site)
开发者ID:AbdealiJK,项目名称:pywikibot-core,代码行数:13,代码来源:template_bot_tests.py
示例11: test_match_msg
def test_match_msg(self):
"""Test pages with {{msg:..}}."""
template = pywikibot.Page(self.site, 'Template:Foo')
builder = _MultiTemplateMatchBuilder(self.site)
predicate = builder.search_any_predicate([template])
gen = XMLDumpPageGenerator(
filename=join_xml_data_path('dummy-template.xml'),
site=self.site,
text_predicate=predicate)
pages = list(gen)
self.assertEqual(len(pages), 1)
self.assertPagelistTitles(pages, ['Fake page with msg'],
site=self.site)
开发者ID:AbdealiJK,项目名称:pywikibot-core,代码行数:14,代码来源:template_bot_tests.py
示例12: setUpClass
def setUpClass(cls):
"""Define base_file and original_content."""
super(OpenArchiveTestCase, cls).setUpClass()
cls.base_file = join_xml_data_path('article-pyrus.xml')
with open(cls.base_file, 'rb') as f:
cls.original_content = f.read()
开发者ID:Tillsa,项目名称:pywikibot_test_wikidata,代码行数:6,代码来源:tools_tests.py
示例13: test_XmlDumpRedirect
def test_XmlDumpRedirect(self):
"""Test XmlDump correctly parsing whether a page is a redirect."""
pages = self._get_entries('article-pyrus.xml', allrevisions=True)
pages = [r for r in
xmlreader.XmlDump(join_xml_data_path('article-pyrus.xml')).parse()]
self.assertTrue(pages[0].isredirect)
开发者ID:AbdealiJK,项目名称:pywikibot-core,代码行数:6,代码来源:xmlreader_tests.py
示例14: _get_entries
def _get_entries(self, filename, **kwargs):
"""Get all entries via XmlDump."""
entries = [r for r in
xmlreader.XmlDump(join_xml_data_path(filename),
**kwargs).parse()]
return entries
开发者ID:AbdealiJK,项目名称:pywikibot-core,代码行数:6,代码来源:xmlreader_tests.py
示例15: test_xml_simple
def test_xml_simple(self):
"""Test the generator without any narrowing."""
main('-xml:' + join_xml_data_path('dummy-reflinks.xml'))
gen = self.constructor_args[0]
self.assertPageTitlesCountEqual(gen, [u'Fake page', u'Talk:Fake page'],
site=self.get_site())
开发者ID:PersianWikipedia,项目名称:pywikibot-core,代码行数:6,代码来源:reflinks_tests.py
注:本文中的tests.join_xml_data_path函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论