tests.textlib_tests module#
Test textlib module.
- class tests.textlib_tests.TestAddText(*args, **kwargs)[source]#
Bases:
DisconnectedSiteMixin,DefaultDrySiteTestCaseTest add_text function.
- abstract_class = False#
- code = 'test'#
- dry = True#
- family = 'wikipedia'#
- site = True#
- sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
- class tests.textlib_tests.TestCategoryRearrangement(*args, **kwargs)[source]#
Bases:
DisconnectedSiteMixin,DefaultDrySiteTestCaseEnsure that sorting keys are not being lost.
Tests .getCategoryLinks() and .replaceCategoryLinks(), with both a newline and an empty string as separators.
- abstract_class = False#
- code = 'test'#
- dry = True#
- family = 'wikipedia'#
- old = '[[Category:Cat1]]\n[[Category:Cat2|]]\n[[Category:Cat1| ]]\n[[Category:Cat2|key]]'#
- site = True#
- sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
- class tests.textlib_tests.TestDigitsConversion(*args, **kwargs)[source]#
Bases:
DisableSiteMixin,TestCaseTest to verify that local digits are correctly being handled.
- abstract_class = False#
- class tests.textlib_tests.TestDisabledParts(*args, **kwargs)[source]#
Bases:
DisconnectedSiteMixin,DefaultDrySiteTestCaseTest the removeDisabledParts function in textlib.
- abstract_class = False#
- code = 'test'#
- dry = True#
- family = 'wikipedia'#
- site = True#
- sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
- class tests.textlib_tests.TestExtractSections(*args, **kwargs)[source]#
Bases:
DisconnectedSiteMixin,DefaultDrySiteTestCaseTest the extract_sections function.
- abstract_class = False#
- code = 'test'#
- dry = True#
- family = 'wikipedia'#
- site = True#
- sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
- test_long_comment()[source]#
Test for text having a long expanse of white space.
This is to catch certain regex issues caused by patterns like r’(s+)*$’ (as found in older versions of extract_section). They may not halt.
Test for text having no sections or footer.
Test for text having footer but no section.
Test for text having sections but no footer.
Test for text having sections and footer.
- class tests.textlib_tests.TestFormatCategory(*args, **kwargs)[source]#
Bases:
DisconnectedSiteMixin,DefaultDrySiteTestCaseTest category formatting.
- abstract_class = False#
- catresult = '[[Category:Cat1]]\n[[Category:Cat2]]\n'#
- code = 'test'#
- dry = True#
- family = 'wikipedia'#
- site = True#
- sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
- class tests.textlib_tests.TestFormatInterwiki(*args, **kwargs)[source]#
Bases:
CheckHostnameMixin,ForceCacheMixin,TestCaseTest format functions.
- abstract_class = False#
- cached = True#
- code = 'en'#
- family = 'wikipedia'#
- net = True#
- site = True#
- sites = {'wikipedia:en': {'code': 'en', 'family': 'wikipedia'}}#
- class tests.textlib_tests.TestGetLanguageLinks(*args, **kwargs)[source]#
Bases:
CheckHostnameMixin,SiteAttributeTestCaseTest
textlib.getLanguageLinksfunction.- abstract_class = False#
- example_text = '[[en:Site]] [[de:Site|Piped]] [[commons:Site]] [[baden:Site]] [[fr:{{PAGENAME}}]]'#
- net = True#
- site = True#
- sites = {'commons': {'code': 'commons', 'family': 'commons'}, 'dewp': {'code': 'de', 'family': 'wikipedia'}, 'enwp': {'code': 'en', 'family': 'wikipedia'}}#
- test_getLanguageLinks_commons()#
Test if the function returns the correct titles and sites on commons:commons
- test_getLanguageLinks_dewp()#
Test if the function returns the correct titles and sites on wikipedia:de
- test_getLanguageLinks_enwp()#
Test if the function returns the correct titles and sites on wikipedia:en
- class tests.textlib_tests.TestMultiTemplateMatchBuilder(*args, **kwargs)[source]#
Bases:
DisconnectedSiteMixin,DefaultDrySiteTestCaseTest MultiTemplateMatchBuilder.
- abstract_class = False#
- code = 'test'#
- dry = True#
- family = 'wikipedia'#
- site = True#
- sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
- class tests.textlib_tests.TestReplaceExcept(*args, **kwargs)[source]#
Bases:
DisconnectedSiteMixin,DefaultDrySiteTestCaseTest to verify the replacements with exceptions are done correctly.
- abstract_class = False#
- code = 'test'#
- dry = True#
- family = 'wikipedia'#
- site = True#
- sites = {'wikipedia:test': {'code': 'test', 'family': 'wikipedia'}}#
- class tests.textlib_tests.TestReplaceLinks(*args, **kwargs)[source]#
Bases:
DisconnectedSiteMixin,TestCaseTest the replace_links function in textlib.
- abstract_class = False#
- dry = True#
- site = True#
- sites = {'wp': {'code': 'en', 'family': 'wikipedia'}, 'wt': {'code': 'en', 'family': 'wiktionary'}}#
- test_replace_invalid_link_text()[source]#
Test that it doesn’t pipe a link when it’s an invalid link.
- test_replacements_simplify()[source]#
Test a tuple as replacement removing the need for a piped link.
- text = 'Hello [[World]], [[how|are]] [[you#section|you]]? Are [[you]] a [[bug:1337]]?'#
- class tests.textlib_tests.TestReplaceLinksNonDry(*args, **kwargs)[source]#
Bases:
CheckHostnameMixin,ForceCacheMixin,TestCaseTest the replace_links function in textlib non-dry.
- abstract_class = False#
- cached = True#
- code = 'en'#
- family = 'wikipedia'#
- net = True#
- site = True#
- sites = {'wikipedia:en': {'code': 'en', 'family': 'wikipedia'}}#
- class tests.textlib_tests.TestSectionFunctions(*args, **kwargs)[source]#
Bases:
DisableSiteMixin,TestCaseTest wikitext section handling function.
- abstract_class = False#
- class tests.textlib_tests.TestTemplateParams(*args, **kwargs)[source]#
Bases:
DisableSiteMixin,TestCaseTest to verify that template params extraction works.
- abstract_class = False#
- class tests.textlib_tests.TestTemplatesInCategory(*args, **kwargs)[source]#
Bases:
CheckHostnameMixin,ForceCacheMixin,TestCaseTests to verify that templates in category links are handled.
- abstract_class = False#
- cached = True#
- code = 'en'#
- family = 'wikipedia'#
- net = True#
- site = True#
- sites = {'wikipedia:en': {'code': 'en', 'family': 'wikipedia'}}#