tests.cosmetic_changes_tests module#

Test cosmetic_changes module.

class tests.cosmetic_changes_tests.TestCosmeticChanges(*args, **kwargs)[source]#

Bases: TestCase

Test cosmetic changes methods.

abstract_class = True#
code = 'de'#
family = 'wikipedia'#
classmethod setUpClass()[source]#

Setup class for all tests.

class tests.cosmetic_changes_tests.TestCosmeticChangesISBN(*args, **kwargs)[source]#

Bases: DisconnectedSiteMixin, TestCosmeticChanges

Test CosmeticChanges ISBN fix.

ISBN_CHECKSUMERROR_RE = 'ISBN checksum of [0-9]+ is incorrect'#
ISBN_DIGITERROR_RE = 'ISBN [0-9]+ is not [0-9]+ digits long'#
ISBN_INVALIDCHARERROR_RE = 'ISBN [0-9a-zA-Z]+ contains invalid characters'#
ISBN_INVALIDCHECKERROR_RE = 'checksum or check digit is invalid'#
ISBN_INVALIDERROR_RE = 'Invalid ISBN found'#
ISBN_INVALIDLENGTHERROR_RE = 'The number has an invalid length'#
abstract_class = False#
code = 'de'#
dry = True#
family = 'wikipedia'#
classmethod setUpClass()[source]#

Skip tests if isbn libraries are missing.

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

Test fixing ISBN numbers with an invalid ISBN.

test_invalid_isbn()[source]#

Test that it’ll fail when the ISBN is invalid.

test_valid_isbn()[source]#

Test ISBN.

class tests.cosmetic_changes_tests.TestCosmeticChangesPersian(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, TestCosmeticChanges

Test cosmetic changes methods in Persian Wikipedia.

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

Test fixArabicLetters comma replacements.

test_fix_arabic_letters_comma_skip()[source]#

Test fixArabicLetters Latin comma not replaced.

test_fix_arabic_letters_letters()[source]#

Test fixArabicLetters letter replacements.

class tests.cosmetic_changes_tests.TestDryCosmeticChanges(*args, **kwargs)[source]#

Bases: DisconnectedSiteMixin, TestCosmeticChanges

Test cosmetic_changes not requiring a live wiki.

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

Test cleanUpSectionHeaders method.

test_fixArabicLetters()[source]#

Test fixArabicLetters.

test_fixHtml()[source]#

Test fixHtml method.

test_fixReferences()[source]#

Test fixReferences method.

test_fixSelfInterwiki()[source]#

Test fixSelfInterwiki method.

test_fixTypo()[source]#

Test fixTypo method.

test_putSpacesInLists()[source]#

Test putSpacesInLists method.

test_removeNonBreakingSpaceBeforePercent()[source]#

Test removeNonBreakingSpaceBeforePercent method.

test_removeUselessSpaces()[source]#

Test removeUselessSpaces method.

test_replaceDeprecatedTemplates()[source]#

Test replaceDeprecatedTemplates method.

test_resolveHtmlEntities()[source]#

Test resolveHtmlEntities method.

test_standardizePageFooter()[source]#

Test standardizePageFooter method.

class tests.cosmetic_changes_tests.TestDryFixSyntaxSave(*args, **kwargs)[source]#

Bases: DisconnectedSiteMixin, TestCosmeticChanges

Test fixSyntaxSave not requiring a live wiki.

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

Setup class for all tests.

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

Test fixing brackets.

test_fix_files_and_categories()[source]#

Test files and categories fix.

Test fixing link text.

test_fix_missing_bracket()[source]#

Test fixing missing bracket.

test_fix_url()[source]#

Test fixing urls.

test_title_param()[source]#

Test fixing url with title parameter.

class tests.cosmetic_changes_tests.TestLiveCosmeticChanges(*args, **kwargs)[source]#

Bases: CheckHostnameMixin, TestCosmeticChanges

Test cosmetic_changes requiring a live wiki.

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

Test cleanUpLinks method.

Test cleanUpLinks method.

This method fails for the given samples from library. Either the method has to be changed or the examples must be fixed.

test_removeEmptySections()[source]#

Test removeEmptySections method.

Test removeEmptySections with edge cases of language links.

test_remove_empty_sections_with_heading_comments()[source]#

Test removeEmptySections with comments in the section headings.

test_replace_deprecated_templates()[source]#

Test replaceDeprecatedTemplates method.

test_translateMagicWords_fail()[source]#

Test translateMagicWords method.

The current implementation doesn’t check whether the magic word is inside a template.

test_translate_and_capitalize_namespaces()[source]#

Test translateAndCapitalizeNamespaces method.

test_translate_magic_words()[source]#

Test translateMagicWords method.