tests.site_generators_tests module#

Tests for generators of the site module.

class tests.site_generators_tests.SearchTestCase(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, DefaultSiteTestCase

Test search method.

abstract_class = False#
code = 'test'#
family = 'wikipedia'#
net = True#
site = True#
sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#

Test the site.search() method.

test_search_where_title()[source]#

Test site.search() method with ‘where’ parameter set to title.

class tests.site_generators_tests.SiteRandomTestCase(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, DefaultSiteTestCase

Test random methods of a site.

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

Skip test on beta due to T282602.

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

Test site.randompages() with both types.

test_limit_10()[source]#

Test site.randompages() with limit.

test_namespaces()[source]#

Test site.randompages() with namespaces.

test_redirects()[source]#

Test site.randompages() with redirects.

test_unlimited_small_step()[source]#

Test site.randompages() continuation.

Note that uniqueness is not guaranteed if multiple requests are performed, so we also don’t test this here.

class tests.site_generators_tests.SiteWatchlistRevsTestCase(*args, **kwargs)[source]#

Bases: RequireLoginMixin, CheckHostnameMixin, DefaultSiteTestCase

Test site method watchlist_revs().

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

Test the site.watchlist_revs() method.

class tests.site_generators_tests.TestAlldeletedrevisionsAsUser(*args, **kwargs)[source]#

Bases: RequireLoginMixin, CheckHostnameMixin, DefaultSiteTestCase

Test site method site.alldeletedrevisions() with bot user.

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

Test the site.alldeletedrevisions() method.

test_excludeuser()[source]#

Test the site.alldeletedrevisions() method using excludeuser.

test_invalid_range()[source]#

Test site.alldeletedrevisions() method with invalid range.

test_namespaces()[source]#

Test the site.alldeletedrevisions() method using namespaces.

test_user_range()[source]#

Test the site.alldeletedrevisions() method with range.

test_user_range_reverse()[source]#

Test the site.alldeletedrevisions() method with range reversed.

class tests.site_generators_tests.TestAlldeletedrevisionsWithoutUser(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, DefaultSiteTestCase

Test site method site.alldeletedrevisions() without bot user.

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

Test the site.alldeletedrevisions() method with prefix.

Bases: CheckHostnameMixin, ForceCacheMixin, TestCase

Test for backlinks (issue T194233).

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

Setup tests.

site = True#
sites = {'wikipedia:en': {'code': 'en', 'family': 'wikipedia'}}#

Test backlinks redirects length.

Test backlinks redirects pageid.

Test backlinks redirects statur.

class tests.site_generators_tests.TestFileArchive(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, DeprecationTestCase

Test filearchive on Commons.

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

Test filearchive method.

test_filearchive_prefix()[source]#

Test prefix parameter.

test_filearchive_prop()[source]#

Test properties.

test_filearchive_reverse()[source]#

Test reverse parameter.

test_filearchive_sha1()[source]#

Test sha1 parameter.

test_filearchive_start()[source]#

Test start/end parameters.

class tests.site_generators_tests.TestImageUsage(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, DefaultSiteTestCase

Test cases for Site.imageusage method.

abstract_class = False#
cached = True#
code = 'test'#
family = 'wikipedia'#
property imagepage#

Find an image which is used on the main page.

If there are no images included in main page it’ll skip all tests.

Note

This is not implemented as setUpClass which would be invoked while initialising all tests, to reduce chance of an error preventing all tests from running.

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

Test the site.imageusage() method.

test_image_usage_in_namespaces()[source]#

Test the site.imageusage() method with namespaces.

test_image_usage_in_redirects()[source]#

Test the site.imageusage() method on redirects only.

test_image_usage_no_redirect_filter()[source]#

Test the site.imageusage() method with redirects.

class tests.site_generators_tests.TestLoadPagesFromPageids(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, DefaultSiteTestCase

Test site.load_pages_from_pageids().

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

Setup tests.

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

Test loading from comma-separated pageids.

test_load_from_pageids_iterable_in_order()[source]#

Test loading with pageids is ordered.

test_load_from_pageids_iterable_of_int()[source]#

Test basic loading with pageids.

test_load_from_pageids_iterable_of_str()[source]#

Test basic loading with pageids.

test_load_from_pageids_iterable_with_duplicate()[source]#

Test loading with duplicate pageids.

test_load_from_pageids_pipe_separated()[source]#

Test loading from comma-separated pageids.

class tests.site_generators_tests.TestLogEvents(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, DefaultSiteTestCase

Test logevents methods.

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

Test logevents method.

test_logevents_mainpage()[source]#

Test logevents method on the main page.

test_logevents_timestamp()[source]#

Test logevents method.

class tests.site_generators_tests.TestPagePreloading(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, DefaultSiteTestCase

Test site.preloadpages().

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

Test outcome is following same order of input.

test_order()[source]#

Test outcome is following same order of input.

test_pageids()[source]#

Test basic preloading with pageids.

test_preload_categories()[source]#

Test preloading categories works.

test_preload_content()[source]#

Test preloading templates and langlinks works.

test_preload_continuation()[source]#

Test preloading continuation works.

test_preload_high_groupsize()[source]#

Test preloading continuation with groupsize greater than total.

test_preload_invalid_titles_without_pageids()[source]#

Test sending invalid titles. No warnings issued, but it should.

Test preloading continuation works.

Test preloading langlinks works.

test_preload_low_groupsize()[source]#

Test preloading continuation with groupsize greater than total.

test_preload_templates()[source]#

Test preloading templates works.

Test preloading templates and langlinks works.

test_preload_unexpected_titles_using_pageids()[source]#

Test sending pageids with unnormalized titles, causing warnings.

test_preload_unexpected_titles_using_titles()[source]#

Test sending unnormalized titles, causing warnings.

test_titles()[source]#

Test basic preloading with titles.

class tests.site_generators_tests.TestRecentChanges(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, DefaultSiteTestCase

Test recentchanges method.

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

Test the site.recentchanges() method.

test_changetype()[source]#

Test the site.recentchanges() with changetype.

test_flags()[source]#

Test the site.recentchanges() with boolean flags.

test_ns_file()[source]#

Test the site.recentchanges() method with File: and File talk:.

test_tag_filter()[source]#

Test the site.recentchanges() with tag filter.

test_time_range()[source]#

Test the site.recentchanges() method with start/end.

class tests.site_generators_tests.TestSiteAPILimits(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, TestCase

Test cases for Site method that use API limits.

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

Test step/total parameters for different sitemethods.

class tests.site_generators_tests.TestSiteGenerators(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, DefaultSiteTestCase

Test cases for Site methods.

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

Initialize self.site and self.mainpage.

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

Test the site.allcategories() method.

test_all_images()[source]#

Test the site.allimages() method.

Test the site.alllinks() method.

test_allpages()[source]#

Test the site.allpages() method.

Test allpages with langlinks disabled.

Test allpages with langlinks enabled.

test_allpages_pagesize()[source]#

Test allpages with page maxsize parameter.

test_allpages_protection()[source]#

Test allpages with protect_type parameter.

test_ancientpages()[source]#

Test the site.ancientpages() method.

test_assert_valid_iter_params()[source]#

Test site.assert_valid_iter_params method.

Test Site.pagebacklinks.

test_blocks()[source]#

Test the site.blocks() method.

test_categorymembers()[source]#

Test Site.categorymembers.

test_embeddedin()[source]#

Test Site.page_embeddedin.

test_exturl_usage()[source]#

Test the site.exturlusage() method.

test_generator_namespace()[source]#

Test site._generator with namespaces.

test_longpages()[source]#

Test the site.longpages() method.

Test Site.extlinks.

test_page_redirects()[source]#

Test Site.page_redirects.

test_pagecategories()[source]#

Test Site.pagecategories.

test_pageimages()[source]#

Test Site.pageimages.

Test Site.pagelanglinks.

Test Site.pagelinks.

test_pagereferences()[source]#

Test Site.pagereferences.

test_pages_with_property()[source]#

Test pages_with_property method.

test_pagetemplates()[source]#

Test Site.pagetemplates.

test_protectedpages_create()[source]#

Test that protectedpages returns protected page titles.

test_protectedpages_edit()[source]#

Test that protectedpages returns protected pages.

test_protectedpages_edit_level()[source]#

Test protectedpages protection level.

test_querypage()[source]#

Test the site.querypage() method.

test_shortpages()[source]#

Test the site.shortpages() method.

test_unconnected()[source]#

Test site.unconnected_pages method.

test_unwatchedpages()[source]#

Test the site.unwatchedpages() method.

class tests.site_generators_tests.TestSiteGeneratorsUsers(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, DefaultSiteTestCase

Test cases for Site methods with users.

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

Initialize self.site and self.mainpage.

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

Test the site.allusers() method.

test_allusers_with_prefix()[source]#

Test the site.allusers(prefix=..) method.

test_allusers_with_start()[source]#

Test the site.allusers(start=..) method.

test_botusers()[source]#

Test the site.botusers() method.

class tests.site_generators_tests.TestSiteLoadRevisions(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, TestCase

Test cases for Site.loadrevision() method.

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

Setup tests.

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

Test the site.loadrevisions() method.

test_loadrevisions_content()[source]#

Test the site.loadrevisions() method with content=True.

test_loadrevisions_excludeuser()[source]#

Test the site.loadrevisions() method, excluding user.

test_loadrevisions_querycontinue()[source]#

Test the site.loadrevisions() method with query-continue.

test_loadrevisions_rev_id()[source]#

Test the site.loadrevisions() method, listing based on rev_id.

test_loadrevisions_revdir()[source]#

Test the site.loadrevisions() method with rvdir=True.

test_loadrevisions_revids()[source]#

Test the site.loadrevisions() method, listing based on revid.

test_loadrevisions_timestamp()[source]#

Test the site.loadrevisions() method, listing based on timestamp.

test_loadrevisions_user()[source]#

Test the site.loadrevisions() method, filtering by user.

class tests.site_generators_tests.TestUserContribsAsUser(*args, **kwargs)[source]#

Bases: RequireLoginMixin, CheckHostnameMixin, DefaultSiteTestCase

Test site method site.usercontribs() with bot user.

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

Test the site.usercontribs() method.

test_namespaces()[source]#

Test the site.usercontribs() method using namespaces.

test_show_minor()[source]#

Test the site.usercontribs() method using showMinor.

class tests.site_generators_tests.TestUserContribsWithoutUser(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, DefaultSiteTestCase

Test site method site.usercontribs() without bot user.

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

Test the site.usercontribs() method with invalid parameters.

test_user_prefix()[source]#

Test the site.usercontribs() method with userprefix.

test_user_prefix_range()[source]#

Test the site.usercontribs() method.

test_user_prefix_reverse()[source]#

Test the site.usercontribs() method with range reversed.

class tests.site_generators_tests.TestUserList(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, DefaultSiteTestCase

Test usernames Jimbo Wales, Brion VIBBER and Tim Starling.

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

Test the site.users() method with preset usernames.

class tests.site_generators_tests.TestUserRecentChanges(*args, **kwargs)[source]#

Bases: RequireLoginMixin, CheckHostnameMixin, DefaultSiteTestCase

Test recentchanges method requiring a user.

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

Test the site.recentchanges() with patrolled boolean flags.

class tests.site_generators_tests.TestUserWatchedPages(*args, **kwargs)[source]#

Bases: RequireLoginMixin, CheckHostnameMixin, DefaultSiteTestCase

Test user watched pages.

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

Test the site.watched_pages() method.

test_watched_pages_uncached()[source]#

Test the site.watched_pages() method uncached.