tests.archivebot_tests module#

Tests for archivebot scripts.

class tests.archivebot_tests.TestArchiveBot(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, TestCase

Test archivebot script on 40+ Wikipedia sites.

abstract_class = False#
cached = True#
expected_failures = ['ar', 'scn', 'th']#
family = 'wikipedia'#
net = True#
site = True#
sites = {'als': {'code': 'als', 'family': 'wikipedia'}, 'ar': {'code': 'ar', 'family': 'wikipedia'}, 'bar': {'code': 'bar', 'family': 'wikipedia'}, 'bg': {'code': 'bg', 'family': 'wikipedia'}, 'bjn': {'code': 'bjn', 'family': 'wikipedia'}, 'bs': {'code': 'bs', 'family': 'wikipedia'}, 'ca': {'code': 'ca', 'family': 'wikipedia'}, 'ckb': {'code': 'ckb', 'family': 'wikipedia'}, 'cs': {'code': 'cs', 'family': 'wikipedia'}, 'de': {'code': 'de', 'family': 'wikipedia'}, 'en': {'code': 'en', 'family': 'wikipedia'}, 'eo': {'code': 'eo', 'family': 'wikipedia'}, 'es': {'code': 'es', 'family': 'wikipedia'}, 'fa': {'code': 'fa', 'family': 'wikipedia'}, 'fr': {'code': 'fr', 'family': 'wikipedia'}, 'frr': {'code': 'frr', 'family': 'wikipedia'}, 'hi': {'code': 'hi', 'family': 'wikipedia'}, 'hr': {'code': 'hr', 'family': 'wikipedia'}, 'hu': {'code': 'hu', 'family': 'wikipedia'}, 'id': {'code': 'id', 'family': 'wikipedia'}, 'it': {'code': 'it', 'family': 'wikipedia'}, 'ja': {'code': 'ja', 'family': 'wikipedia'}, 'la': {'code': 'la', 'family': 'wikipedia'}, 'lt': {'code': 'lt', 'family': 'wikipedia'}, 'nl': {'code': 'nl', 'family': 'wikipedia'}, 'nn': {'code': 'nn', 'family': 'wikipedia'}, 'no': {'code': 'no', 'family': 'wikipedia'}, 'pdc': {'code': 'pdc', 'family': 'wikipedia'}, 'pfl': {'code': 'pfl', 'family': 'wikipedia'}, 'pl': {'code': 'pl', 'family': 'wikipedia'}, 'pt': {'code': 'pt', 'family': 'wikipedia'}, 'ro': {'code': 'ro', 'family': 'wikipedia'}, 'ru': {'code': 'ru', 'family': 'wikipedia'}, 'scn': {'code': 'scn', 'family': 'wikipedia'}, 'simple': {'code': 'simple', 'family': 'wikipedia'}, 'sr': {'code': 'sr', 'family': 'wikipedia'}, 'sv': {'code': 'sv', 'family': 'wikipedia'}, 'th': {'code': 'th', 'family': 'wikipedia'}, 'tr': {'code': 'tr', 'family': 'wikipedia'}, 'ug': {'code': 'ug', 'family': 'wikipedia'}, 'uk': {'code': 'uk', 'family': 'wikipedia'}, 'uz': {'code': 'uz', 'family': 'wikipedia'}, 'vi': {'code': 'vi', 'family': 'wikipedia'}, 'zh': {'code': 'zh', 'family': 'wikipedia'}, 'zh-yue': {'code': 'zh-yue', 'family': 'wikipedia'}}#
test_archivebot_als()#

Test archivebot for one site on wikipedia:als

test_archivebot_ar()#

Test archivebot for one site on wikipedia:ar

test_archivebot_bar()#

Test archivebot for one site on wikipedia:bar

test_archivebot_bg()#

Test archivebot for one site on wikipedia:bg

test_archivebot_bjn()#

Test archivebot for one site on wikipedia:bjn

test_archivebot_bs()#

Test archivebot for one site on wikipedia:bs

test_archivebot_ca()#

Test archivebot for one site on wikipedia:ca

test_archivebot_ckb()#

Test archivebot for one site on wikipedia:ckb

test_archivebot_cs()#

Test archivebot for one site on wikipedia:cs

test_archivebot_de()#

Test archivebot for one site on wikipedia:de

test_archivebot_en()#

Test archivebot for one site on wikipedia:en

test_archivebot_eo()#

Test archivebot for one site on wikipedia:eo

test_archivebot_es()#

Test archivebot for one site on wikipedia:es

test_archivebot_fa()#

Test archivebot for one site on wikipedia:fa

test_archivebot_fr()#

Test archivebot for one site on wikipedia:fr

test_archivebot_frr()#

Test archivebot for one site on wikipedia:frr

test_archivebot_hi()#

Test archivebot for one site on wikipedia:hi

test_archivebot_hr()#

Test archivebot for one site on wikipedia:hr

test_archivebot_hu()#

Test archivebot for one site on wikipedia:hu

test_archivebot_id()#

Test archivebot for one site on wikipedia:id

test_archivebot_it()#

Test archivebot for one site on wikipedia:it

test_archivebot_ja()#

Test archivebot for one site on wikipedia:ja

test_archivebot_la()#

Test archivebot for one site on wikipedia:la

test_archivebot_lt()#

Test archivebot for one site on wikipedia:lt

test_archivebot_nl()#

Test archivebot for one site on wikipedia:nl

test_archivebot_nn()#

Test archivebot for one site on wikipedia:nn

test_archivebot_no()#

Test archivebot for one site on wikipedia:no

test_archivebot_pdc()#

Test archivebot for one site on wikipedia:pdc

test_archivebot_pfl()#

Test archivebot for one site on wikipedia:pfl

test_archivebot_pl()#

Test archivebot for one site on wikipedia:pl

test_archivebot_pt()#

Test archivebot for one site on wikipedia:pt

test_archivebot_ro()#

Test archivebot for one site on wikipedia:ro

test_archivebot_ru()#

Test archivebot for one site on wikipedia:ru

test_archivebot_scn()#

Test archivebot for one site on wikipedia:scn

test_archivebot_simple()#

Test archivebot for one site on wikipedia:simple

test_archivebot_sr()#

Test archivebot for one site on wikipedia:sr

test_archivebot_sv()#

Test archivebot for one site on wikipedia:sv

test_archivebot_th()#

Test archivebot for one site on wikipedia:th

test_archivebot_tr()#

Test archivebot for one site on wikipedia:tr

test_archivebot_ug()#

Test archivebot for one site on wikipedia:ug

test_archivebot_uk()#

Test archivebot for one site on wikipedia:uk

test_archivebot_uz()#

Test archivebot for one site on wikipedia:uz

test_archivebot_vi()#

Test archivebot for one site on wikipedia:vi

test_archivebot_zh()#

Test archivebot for one site on wikipedia:zh

test_archivebot_zh_yue()#

Test archivebot for one site on wikipedia:zh-yue

class tests.archivebot_tests.TestArchiveBotAfterDateUpdate(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, TestCase

Test archivebot script on failures on Wikipedia sites.

If failure is due to updated date format on wiki, test pages with new format only.

abstract_class = False#
cached = True#
family = 'wikipedia'#
net = True#
site = True#
sites = {'eo': {'code': 'eo', 'family': 'wikipedia'}, 'pdc': {'code': 'pdc', 'family': 'wikipedia'}}#
test_archivebot_eo()#

Test archivebot for one site on wikipedia:eo

test_archivebot_pdc()#

Test archivebot for one site on wikipedia:pdc

class tests.archivebot_tests.TestArchiveBotFunctions(*args, **kwargs)[source]#

Bases: DisableSiteMixin, TestCase

Test functions in archivebot.

abstract_class = False#
test_str2size()[source]#

Test for parsing the shorthand notation of sizes.

test_str2size_failures()[source]#

Test for rejecting of invalid shorthand notation of sizes.

class tests.archivebot_tests.TestArchiveBotFunctionsWithSites(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, TestCase

Test functions dependent to sites in archivebot.

abstract_class = False#
net = True#
site = True#
sites = {'enwiki': {'code': 'en', 'family': 'wikipedia'}, 'frwikt': {'code': 'fr', 'family': 'wiktionary'}, 'jawiki': {'code': 'ja', 'family': 'wikipedia'}}#
test_str2localized_duration_English()[source]#

Test English localizations of duration.

test_str2localized_duration_French()[source]#

Test French localizations of duration.

test_str2localized_duration_Japanese()[source]#

Test Japanese localizations of duration.

class tests.archivebot_tests.TestDiscussionPageObject(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, TestCase

Test DiscussionPage object.

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

Load the given page.

Parameters:

title (str) –

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

Test recognizing threads with subsections.

Talk:For-pywikibot-archivebot/subsections must have:

{{User:MiszaBot/config
|archive = Talk:Main_Page/archive
|algo = old(30d)
}}
= Front matter =
placeholder
== A ==
foo bar
=== A1 ===
foo bar bar
==== A11 ====
foo
== B ==
foo bar bar bar
testTwoThreadsWithCommentedOutThread()[source]#

Test recognizing two threads and ignoring a commented out thread.

Talk:For-pywikibot-archivebot must have:

{{User:MiszaBot/config
|archive = Talk:Main_Page/archive
|algo = old(30d)
}}
<!-- normal comments -->
== A ==
foo bar
<!--
== Z ==
foo bar bar
-->
== B ==
foo bar bar bar
test_is_full_method()[source]#

Test DiscussionPage.is_full method.

class tests.archivebot_tests.TestPageArchiverObject(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, ForceCacheMixin, TestCase

Test PageArchiver object.

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

Test loading of config with TEMPLATE_PAGE not in Template ns.

Talk:For-pywikibot-archivebot must have:

{{User:MiszaBot/config
|archive = Talk:Main_Page/archive
|algo = old(30d)
}}
testLoadConfigInTemplateNamespace()[source]#

Test loading of config with TEMPLATE_PAGE in Template ns.

Talk:For-pywikibot-archivebot-01 must have:

{{Pywikibot_archivebot
|archive = Talk:Main_Page/archive
|algo = old(30d)
}}