tests.pagegenerators_tests module#

Test pagegenerators module.

class tests.pagegenerators_tests.BasetitleTestCase(*args, **kwargs)[source]#

Bases: TestCase

Class providing base_title attribute.

abstract_class = True#
base_title = 'Page:06-24-1920 -The Story of the Jones County Calf Case.pdf/{}'#
code = 'en'#
family = 'wikisource'#
setUp()[source]#

Setup tests.

class tests.pagegenerators_tests.DryFactoryGeneratorTest(*args, **kwargs)[source]#

Bases: DisconnectedSiteMixin, TestCase

Dry tests for pagegenerators.GeneratorFactory.

abstract_class = False#
code = 'en'#
dry = True#
family = 'wikipedia'#
site = True#
sites = {'wikipedia:en': {'code': 'en', 'family': 'wikipedia'}}#
test_given_namespaces_with_exclusion()[source]#

Test mixed namespaces with exclusion.

test_immutable_namespaces_on_read()[source]#

Test immutable namespaces on read.

test_invalid_arg()[source]#

Test invalid / non-generator arguments.

test_mixed_namespaces_with_exclusion()[source]#

Test mixed namespaces with exclusion.

test_one_excluded_namespaces()[source]#

Test one excluded namespaces.

test_one_namespace()[source]#

Test one namespace.

test_two_excluded_named_namespaces()[source]#

Test two excluded named namespaces.

test_two_excluded_namespaces()[source]#

Test two excluded namespaces.

test_two_excluded_numeric_namespaces()[source]#

Test two excluded namespaces delimited by colon.

test_two_named_namespaces()[source]#

Test two named namespaces.

test_two_namespaces()[source]#

Test two namespaces.

test_two_numeric_namespaces()[source]#

Test two namespaces delimited by colon.

test_unsupported_quality_level_filter()[source]#

Test unsupported option.

class tests.pagegenerators_tests.EdittimeFilterPageGeneratorTestCase(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, TestCase

Test EdittimeFilterPageGenerator.

abstract_class = False#
code = 'en'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:en': {'code': 'en', 'family': 'wikipedia'}}#
test_first_edit()[source]#

Test first edit.

test_last_edit()[source]#

Test last edit.

titles = ('Eastern Sayan', 'The Addams Family (pinball)', 'Talk:Nowy Sącz', 'Talk:Battle of Węgierska Górka', 'Template:!', 'Template:Template')#
class tests.pagegenerators_tests.EnWikipediaPageGeneratorIntersectTestCase(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, GeneratorIntersectTestCase, RecentChangesTestCase

Page intersect_generators test cases.

abstract_class = False#
code = 'en'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:en': {'code': 'en', 'family': 'wikipedia'}}#
test_intersect_newpages_csd()[source]#

Test intersection between newpages and sd candidates.

class tests.pagegenerators_tests.EventStreamsPageGeneratorTestCase(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, RecentChangesTestCase

Test case for Live Recent Changes pagegenerator.

abstract_class = False#
code = 'test'#
family = 'wikipedia'#
net = True#
classmethod setUpClass()[source]#

Setup test class.

site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_RC_pagegenerator_result()[source]#

Test RC pagegenerator.

class tests.pagegenerators_tests.PageGeneratorIntersectTestCase(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, GeneratorIntersectTestCase, RecentChangesTestCase

Page intersect_generators test cases.

abstract_class = False#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_intersect_newpages_and_recentchanges()[source]#

Test intersection betweem newpages and recentchanges.

test_intersect_newpages_twice()[source]#

Test newpages intersection.

class tests.pagegenerators_tests.PetScanPageGeneratorTestCase(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, TestCase

Test PetScanPageGenerator.

abstract_class = False#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_petscan()[source]#

Test PetScanPageGenerator.

class tests.pagegenerators_tests.RedirectFilterPageGeneratorTestCase(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, TestCase

Test RedirectFilterPageGenerator.

abstract_class = False#
code = 'en'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:en': {'code': 'en', 'family': 'wikipedia'}}#
test_redirect_filter()[source]#

Test RedirectFilterPageGenerator with handle_args().

class tests.pagegenerators_tests.SubpageFilterGeneratorTestCase(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, TestCase

Test SubpageFilterGenerator.

abstract_class = False#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_subpage_filter()[source]#

Test SubpageFilterGenerator.

class tests.pagegenerators_tests.TestCategoryFilterPageGenerator(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, BasetitleTestCase

Test CategoryFilterPageGenerator method.

abstract_class = False#
category_list = ['Category:Validated']#
code = 'en'#
family = 'wikisource'#
net = True#
setUp()[source]#

Setup tests.

site = True#
sites = {'wikisource:en': {'code': 'en', 'family': 'wikisource'}}#
test_CategoryFilterPageGenerator()[source]#

Test CategoryFilterPageGenerator.

class tests.pagegenerators_tests.TestDayPageGenerator(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, DefaultSiteTestCase

Test the day page generator.

abstract_class = False#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_basic()[source]#

General test for day page generator.

test_end_13()[source]#

Test for day page generator with endMonth 13.

test_start_0()[source]#

Test for day page generator with startMonth 0.

test_year_2001()[source]#

Test for day page generator of year 2001.

test_year_2100()[source]#

Test for day page generator of year 2100.

class tests.pagegenerators_tests.TestDequePreloadingGenerator(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, DefaultSiteTestCase

Test preloading generator on lists.

abstract_class = False#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_deque_preloading()[source]#

Test pages being added to a DequePreloadingGenerator.

class tests.pagegenerators_tests.TestDryPageGenerators(*args, **kwargs)[source]#

Bases: DisconnectedSiteMixin, TestCase

Test pagegenerators methods.

abstract_class = False#
assertFunction(obj)[source]#

Assert function test.

code = 'en'#
dry = True#
family = 'wikipedia'#
setUp()[source]#

Setup test.

site = True#
sites = {'wikipedia:en': {'code': 'en', 'family': 'wikipedia'}}#
test_NamespaceFilterPageGenerator()[source]#

Test NamespaceFilterPageGenerator.

test_PagesFromTitlesGenerator()[source]#

Test PagesFromTitlesGenerator.

test_RegexBodyFilterPageGenerator()[source]#

Test RegexBodyFilterPageGenerator.

test_RegexFilterPageGenerator()[source]#

Test RegexFilterPageGenerator.

test_module_import()[source]#

Test module import.

titles = ('Eastern Sayan', 'The Addams Family (pinball)', 'Talk:Nowy Sącz', 'Talk:Battle of Węgierska Górka', 'Template:!', 'Template:Template', 'Cities in Burkina Faso', 'Talk:Hispanic (U.S. Census)', 'Talk:Stołpce', 'Template:!/Doc', 'Template:!/Meta', 'Template:Template/Doc', 'Template:Template/Meta')#
class tests.pagegenerators_tests.TestFactoryGenerator(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, DefaultSiteTestCase

Test pagegenerators.GeneratorFactory.

abstract_class = False#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_allpages_default()[source]#

Test allpages generator.

test_allpages_ns()[source]#

Test allpages generator with namespace argument.

test_allpages_with_two_ns()[source]#

Test that allpages fails with two ns as parameter.

test_combined_generator()[source]#

Test getCombinedGenerator with generator parameter.

test_empty_generator()[source]#

Test empty generator.

test_intersect_generator()[source]#

Test getCombinedGenerator with -intersect option.

test_linter_generator_invalid_cat()[source]#

Test generator of pages with lint errors.

test_linter_generator_ns_valid_cat()[source]#

Test generator of pages with lint errors.

test_linter_generator_show()[source]#

Test generator of pages with lint errors.

test_ns()[source]#

Test namespace option.

test_pagegenerator()[source]#

Test page generator.

test_pageid()[source]#

Test pageid parameter.

test_pages_with_property_generator()[source]#

Test the pages_with_property_generator method.

test_positionalargument()[source]#

Test page generator with positional argument.

test_positionalargument_with_colon()[source]#

Test page generator with positional argument with colon.

test_prefixing_default()[source]#

Test prefixindex generator.

test_prefixing_ns()[source]#

Test prefixindex generator with namespace filter.

test_querypage_generator_with_invalid_page()[source]#

Test generator of pages with lint errors.

test_querypage_generator_with_no_page()[source]#

Test generator of pages with lint errors.

test_querypage_generator_with_valid_page()[source]#

Test generator of pages with lint errors.

test_random_generator_default()[source]#

Test random generator.

test_random_generator_ns()[source]#

Test random generator with namespace.

test_random_generator_ns_multi()[source]#

Test random generator with multiple namespaces.

test_randomredirect_generator_default()[source]#

Test random generator.

test_randomredirect_generator_ns()[source]#

Test random generator with namespace.

test_randomredirect_generator_ns_multi()[source]#

Test random generator with multiple namespaces.

test_recentchanges_default()[source]#

Test recentchanges generator with default namespace setting.

test_recentchanges_ns()[source]#

Test recentchanges generator with namespace.

test_recentchanges_ns_multi()[source]#

Test recentchanges generator with multiple namespaces.

test_recentchanges_rctag()[source]#

Test recentchanges generator with recent changes tag.

test_recentchanges_timespan()[source]#

Test recentchanges generator with offset and duration params.

test_regexfilter_default()[source]#

Test allpages generator with titleregex filter.

test_regexfilter_ns_after()[source]#

Test allpages generator with titleregex and namespace filter.

test_regexfilter_ns_before()[source]#

Test allpages generator with namespace and titleregex filter.

test_regexfilternot_default()[source]#

Test allpages generator with titleregexnot filter.

test_regexfilternot_ns_after()[source]#

Test allpages generator with titleregexnot and namespace filter.

test_regexfilternot_ns_before()[source]#

Test allpages generator with namespace and titleregexnot filter.

class tests.pagegenerators_tests.TestFactoryGeneratorNewpages(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, TestCase

Test pagegenerators.GeneratorFactory for newpages.

abstract_class = False#
net = True#
site = True#
sites = {'commons': {'code': 'commons', 'family': 'commons'}, 'devoy': {'code': 'de', 'family': 'wikivoyage'}, 'eswiki': {'code': 'es', 'family': 'wikipedia'}, 'frsource': {'code': 'fr', 'family': 'wikisource'}, 'meta': {'code': 'meta', 'family': 'meta'}, 'ruwikt': {'code': 'ru', 'family': 'wiktionary'}}#
test_newpages_default_commons()#

Test newpages generator on commons:commons

test_newpages_default_devoy()#

Test newpages generator on wikivoyage:de

test_newpages_default_eswiki()#

Test newpages generator on wikipedia:es

test_newpages_default_frsource()#

Test newpages generator on wikisource:fr

test_newpages_default_meta()#

Test newpages generator on meta:meta

test_newpages_default_ruwikt()#

Test newpages generator on wiktionary:ru

test_newpages_ns_commons()#

Test newpages generator with limit argument and namespace filter on commons:commons

test_newpages_ns_default_commons()#

Test newpages generator with limit argument on commons:commons

test_newpages_ns_default_devoy()#

Test newpages generator with limit argument on wikivoyage:de

test_newpages_ns_default_eswiki()#

Test newpages generator with limit argument on wikipedia:es

test_newpages_ns_default_frsource()#

Test newpages generator with limit argument on wikisource:fr

test_newpages_ns_default_meta()#

Test newpages generator with limit argument on meta:meta

test_newpages_ns_default_ruwikt()#

Test newpages generator with limit argument on wiktionary:ru

test_newpages_ns_devoy()#

Test newpages generator with limit argument and namespace filter on wikivoyage:de

test_newpages_ns_eswiki()#

Test newpages generator with limit argument and namespace filter on wikipedia:es

test_newpages_ns_frsource()#

Test newpages generator with limit argument and namespace filter on wikisource:fr

test_newpages_ns_meta()#

Test newpages generator with limit argument and namespace filter on meta:meta

test_newpages_ns_ruwikt()#

Test newpages generator with limit argument and namespace filter on wiktionary:ru

class tests.pagegenerators_tests.TestFactoryGeneratorWikibase(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, WikidataTestCase

Test pagegenerators.GeneratorFactory on Wikibase site.

abstract_class = False#
cached = True#
code = 'wikidata'#
family = 'wikidata'#
net = True#
site = True#
sites = {'wikidata:wikidata': {'code': 'wikidata', 'family': 'wikidata'}}#
test_get_category_site()[source]#

Test the getCategory method.

test_onlyif()[source]#

Test -onlyif without qualifiers.

test_onlyif_qualifiers()[source]#

Test -onlyif with qualifiers.

test_onlyifnot()[source]#

Test -onlyifnot without qualifiers.

test_searchitem()[source]#

Test -searchitem.

test_searchitem_language()[source]#

Test -searchitem with custom language specified.

wikibase = True#
class tests.pagegenerators_tests.TestItemClaimFilterPageGenerator(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, WikidataTestCase

Test item claim filter page generator generator.

abstract_class = False#
cached = True#
code = 'wikidata'#
family = 'wikidata'#
net = True#
site = True#
sites = {'wikidata:wikidata': {'code': 'wikidata', 'family': 'wikidata'}}#
test_invalid_qualifiers()[source]#

Test ItemClaimFilterPageGenerator with invalid qualifiers.

test_item_from_page()[source]#

Test ItemPage can be obtained form Page.

test_negative_filter()[source]#

Test negative ItemClaimFilterPageGenerator.

test_no_qualifiers()[source]#

Test ItemClaimFilterPageGenerator without qualifiers.

test_nonexisting_qualifiers()[source]#

Test ItemClaimFilterPageGenerator on sample page.

The item does not have the searched qualifiers.

test_valid_qualifiers()[source]#

Test ItemClaimFilterPageGenerator using valid qualifiers.

wikibase = True#
class tests.pagegenerators_tests.TestLinksearchPageGenerator(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, TestCase

Tests for pagegenerators.LinksearchPageGenerator.

abstract_class = False#
code = 'en'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:en': {'code': 'en', 'family': 'wikipedia'}}#
test_double_opposite_protocols()[source]#

Test LinksearchPageGenerator with two opposite protocols.

test_double_same_protocols()[source]#

Test LinksearchPageGenerator with two same protocols.

Test -weblink.

class tests.pagegenerators_tests.TestLogeventsFactoryGenerator(*args, **kwargs)[source]#

Bases: RequireLoginMixin, CheckHostnameMixin, DefaultSiteTestCase, DeprecationTestCase

Test GeneratorFactory with pagegenerators.LogeventsPageGenerator.

abstract_class = False#
code = 'test'#
family = 'wikipedia'#
login = True#
net = True#
classmethod setUpClass()[source]#

Setup test class.

site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_logevents_parse()[source]#

Test wrong logevents option.

test_logevents_with_start_and_end_timestamp()[source]#

Test -logevents which uses timestamps for start and end.

test_logevents_with_start_timestamp()[source]#

Test -logevents which uses timestamp for start.

test_logevents_with_total()[source]#

Test -logevents which uses total.

class tests.pagegenerators_tests.TestPagesFromPageidGenerator(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, BasetitleTestCase

Test PagesFromPageidGenerator method.

abstract_class = False#
code = 'en'#
family = 'wikisource'#
net = True#
site = True#
sites = {'wikisource:en': {'code': 'en', 'family': 'wikisource'}}#
test_PagesFromPageidGenerator()[source]#

Test PagesFromPageidGenerator.

class tests.pagegenerators_tests.TestPreloadingEntityGenerator(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, WikidataTestCase

Test preloading item generator.

abstract_class = False#
cached = True#
code = 'wikidata'#
family = 'wikidata'#
net = True#
site = True#
sites = {'wikidata:wikidata': {'code': 'wikidata', 'family': 'wikidata'}}#
test_non_item_gen()[source]#

Test TestPreloadingEntityGenerator with getReferences.

wikibase = True#
class tests.pagegenerators_tests.TestPreloadingGenerator(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, DefaultSiteTestCase

Test preloading generator on lists.

abstract_class = False#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_basic()[source]#

Test PreloadingGenerator with a list of pages.

test_low_step()[source]#

Test PreloadingGenerator with a list of pages.

test_order()[source]#

Test outcome is following same order of input.

class tests.pagegenerators_tests.TestQualityFilterPageGenerator(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, BasetitleTestCase

Test QualityFilterPageGenerator methods.

abstract_class = False#
base_title = 'Page:Popular Science Monthly Volume 1.djvu/{}'#
cached = True#
code = 'en'#
family = 'wikisource'#
net = True#
site = True#
sites = {'wikisource:en': {'code': 'en', 'family': 'wikisource'}}#
test_QualityFilterPageGenerator()[source]#

Test QualityFilterPageGenerator.

class tests.pagegenerators_tests.TestRepeatingGenerator(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, RecentChangesTestCase

Test RepeatingGenerator.

abstract_class = False#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_RepeatingGenerator()[source]#

Test RepeatingGenerator.

class tests.pagegenerators_tests.TestTextIOPageGenerator(*args, **kwargs)[source]#

Bases: DisconnectedSiteMixin, DefaultSiteTestCase

Test loading pages from a textfile.

abstract_class = False#
code = 'test'#
dry = True#
expected_titles = (('file', 'File'), ('bracket', 'Bracket'), ('MediaWiki:Test', 'MediaWiki:Test'), ('under score', 'Under score'), ('Upper case', 'Upper case'))#
family = 'wikipedia'#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_brackets()[source]#

Test TextIOPageGenerator with brackets.

test_lines()[source]#

Test TextIOPageGenerator with newlines.

test_url(mock_fetch)[source]#

Test TextIOPageGenerator with URL.

title_columns = {'case-sensitive': 0, 'first-letter': 1}#
class tests.pagegenerators_tests.TestUnconnectedPageGenerator(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, DefaultSiteTestCase

Test UnconnectedPageGenerator.

abstract_class = False#
cached = True#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_unconnected_with_repo()[source]#

Test UnconnectedPageGenerator.

test_unconnected_without_repo()[source]#

Test that it raises a ValueError on sites without repository.

class tests.pagegenerators_tests.TestWantedFactoryGenerator(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, DefaultSiteTestCase

Test pagegenerators.GeneratorFactory for wanted pages.

abstract_class = False#
code = 'test'#
family = 'wikipedia'#
net = True#
setUp()[source]#

Setup tests.

site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_wanted_categories()[source]#

Test wantedcategories generator.

test_wanted_files()[source]#

Test wantedfiles generator.

test_wanted_pages()[source]#

Test wantedpages generator.

test_wanted_templates()[source]#

Test wantedtemplates generator.

class tests.pagegenerators_tests.TestYearPageGenerator(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, DefaultSiteTestCase

Test the year page generator.

abstract_class = False#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
test_basic()[source]#

Test YearPageGenerator.

class tests.pagegenerators_tests.WikibaseItemFilterPageGeneratorTestCase(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, TestCase

Test WikibaseItemFilterPageGenerator.

abstract_class = False#
code = 'en'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:en': {'code': 'en', 'family': 'wikipedia'}}#
test_filter_pages_with_item()[source]#

Test WikibaseItemFilterPageGenerator on pages with item.

test_filter_pages_without_item()[source]#

Test WikibaseItemFilterPageGenerator on pages without item.