[MediaWiki-commits] [Gerrit] Add test_link_in_section - change (pywikibot/core)
Xqt has uploaded a new change for review. https://gerrit.wikimedia.org/r/120213 Change subject: Add test_link_in_section .. Add test_link_in_section test textlib.does_text_contain_section() for section headers with links inside Change-Id: Icdd03b9bb5340ed1cad2e8e6f11f65b52495c57d --- M tests/pages/enwiki_help_editing.page M tests/textlib_tests.py 2 files changed, 20 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core refs/changes/13/120213/1 diff --git a/tests/pages/enwiki_help_editing.page b/tests/pages/enwiki_help_editing.page index 2ea663b..fa0f54d 100644 --- a/tests/pages/enwiki_help_editing.page +++ b/tests/pages/enwiki_help_editing.page @@ -54,7 +54,7 @@ ===Adding references=== There is a [[Wikipedia:refToolbar 2.0|tool]] built into the top of the edit box that makes it easier to add and properly format references. The tool can use a single piece of data, such as the [[PMID]] or [[ISBN]], to fill in the rest of the details. -==Wiki markup== +==[[Wiki markup]]== {{main|Help:Wiki markup}} Wiki markup is the extra information (apart from the text which will be displayed) you enter in the edit window which tells the [[MediaWiki]] software how to display, categorize and process the article. @@ -66,7 +66,7 @@ Make sure that you submit information which is relevant to Wikipedia's specific purpose, or your content might be deleted. You can always use the [[Help:Talk page|talk pages]] to ask questions or check to see if your idea will be accepted. Please make note of the license your contributions will be covered by. * [[Wikipedia:Policies and guidelines|Policies and guidelines]] -===Helpful tips=== +===[[:Help]]ful tips=== * [[Wikipedia:Contributing to Wikipedia|Contributing to Wikipedia]] * [[Wikipedia:FAQ/Editing|FAQ/Editing]] * [[Wikipedia:Cheatsheet|Cheatsheet]] @@ -74,7 +74,7 @@ * [[Help:Protection|If the article is protected from editing]] * [[Help:Page history|About page history]] -===Naming and moving=== +=== Naming and moving === * [[Wikipedia:Moving a page|Moving a page to a new name]] * [[Wikipedia:Article titles|Article titles]] * [[Wikipedia:Namespace|Namespace]] diff --git a/tests/textlib_tests.py b/tests/textlib_tests.py index 52aa8e2..748a56b 100644 --- a/tests/textlib_tests.py +++ b/tests/textlib_tests.py @@ -55,10 +55,9 @@ self.assertEqual(func('{{a|b|c=d}}'), [('a', {u'1': 'b', 'c': 'd'})]) self.assertEqual(func('{{a|b={{c'), [('c', {}), (u'a', {u'b': u'{{c}}'})]) -@unittest.expectedFailure def testSpacesInSection(self): self.assertContains(enwiki_help_editing, uMinor_edits) -self.assertNotContains(enwiki_help_editing, uMinor edits, Incorrect, '#Minor edits' does not work) +self.assertNotContains(enwiki_help_editing, u#Minor edits, Incorrect, '#Minor edits' does not work) self.assertNotContains(enwiki_help_editing, uMinor Edits, section hashes are case-sensitive) self.assertNotContains(enwiki_help_editing, uMinor_Edits, section hashes are case-sensitive) @@ -67,6 +66,22 @@ self.assertContains(enwiki_help_editing, uTalk_.28discussion.29_pages, As used in the TOC) self.assertContains(enwiki_help_editing, uTalk_(discussion)_pages, Understood by mediawiki) +def test_spaces_outside_section(self): +self.assertContains(enwiki_help_editing, uNaming and_moving) +self.assertContains(enwiki_help_editing, u Naming and_moving ) +self.assertContains(enwiki_help_editing, u Naming and_moving_) + +def test_link_in_section(self): +# section is ==[[Wiki markup]]== +self.assertContains(enwiki_help_editing, u[[Wiki markup]], Link as section header) +self.assertContains(enwiki_help_editing, u[[:Wiki markup]], section header link with preleading colon) +self.assertNotContains(enwiki_help_editing, uWiki markup, section header must be a link) +# section is ===[[:Help]]ful tips=== +self.assertContains(enwiki_help_editing, u[[Help]]ful tips, Containing link) +self.assertContains(enwiki_help_editing, u[[:Help]]ful tips, Containing link with preleading colon) +self.assertNotContains(enwiki_help_editing, uHelpful tips, section header must contain a link) + + if __name__ == '__main__': try: unittest.main() -- To view, visit https://gerrit.wikimedia.org/r/120213 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icdd03b9bb5340ed1cad2e8e6f11f65b52495c57d Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Xqt i...@gno.de ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add test_link_in_section - change (pywikibot/core)
jenkins-bot has submitted this change and it was merged. Change subject: Add test_link_in_section .. Add test_link_in_section test textlib.does_text_contain_section() for section headers with links inside Change-Id: Icdd03b9bb5340ed1cad2e8e6f11f65b52495c57d --- M tests/pages/enwiki_help_editing.page M tests/textlib_tests.py 2 files changed, 21 insertions(+), 6 deletions(-) Approvals: Merlijn van Deen: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/pages/enwiki_help_editing.page b/tests/pages/enwiki_help_editing.page index 2ea663b..fa0f54d 100644 --- a/tests/pages/enwiki_help_editing.page +++ b/tests/pages/enwiki_help_editing.page @@ -54,7 +54,7 @@ ===Adding references=== There is a [[Wikipedia:refToolbar 2.0|tool]] built into the top of the edit box that makes it easier to add and properly format references. The tool can use a single piece of data, such as the [[PMID]] or [[ISBN]], to fill in the rest of the details. -==Wiki markup== +==[[Wiki markup]]== {{main|Help:Wiki markup}} Wiki markup is the extra information (apart from the text which will be displayed) you enter in the edit window which tells the [[MediaWiki]] software how to display, categorize and process the article. @@ -66,7 +66,7 @@ Make sure that you submit information which is relevant to Wikipedia's specific purpose, or your content might be deleted. You can always use the [[Help:Talk page|talk pages]] to ask questions or check to see if your idea will be accepted. Please make note of the license your contributions will be covered by. * [[Wikipedia:Policies and guidelines|Policies and guidelines]] -===Helpful tips=== +===[[:Help]]ful tips=== * [[Wikipedia:Contributing to Wikipedia|Contributing to Wikipedia]] * [[Wikipedia:FAQ/Editing|FAQ/Editing]] * [[Wikipedia:Cheatsheet|Cheatsheet]] @@ -74,7 +74,7 @@ * [[Help:Protection|If the article is protected from editing]] * [[Help:Page history|About page history]] -===Naming and moving=== +=== Naming and moving === * [[Wikipedia:Moving a page|Moving a page to a new name]] * [[Wikipedia:Article titles|Article titles]] * [[Wikipedia:Namespace|Namespace]] diff --git a/tests/textlib_tests.py b/tests/textlib_tests.py index 52aa8e2..06770d2 100644 --- a/tests/textlib_tests.py +++ b/tests/textlib_tests.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# (C) Pywikipedia bot team, 2007 +# (C) Pywikibot team, 2007-2014 # # Distributed under the terms of the MIT license. # @@ -55,10 +55,9 @@ self.assertEqual(func('{{a|b|c=d}}'), [('a', {u'1': 'b', 'c': 'd'})]) self.assertEqual(func('{{a|b={{c'), [('c', {}), (u'a', {u'b': u'{{c}}'})]) -@unittest.expectedFailure def testSpacesInSection(self): self.assertContains(enwiki_help_editing, uMinor_edits) -self.assertNotContains(enwiki_help_editing, uMinor edits, Incorrect, '#Minor edits' does not work) +self.assertNotContains(enwiki_help_editing, u#Minor edits, Incorrect, '#Minor edits' does not work) self.assertNotContains(enwiki_help_editing, uMinor Edits, section hashes are case-sensitive) self.assertNotContains(enwiki_help_editing, uMinor_Edits, section hashes are case-sensitive) @@ -67,6 +66,22 @@ self.assertContains(enwiki_help_editing, uTalk_.28discussion.29_pages, As used in the TOC) self.assertContains(enwiki_help_editing, uTalk_(discussion)_pages, Understood by mediawiki) +def test_spaces_outside_section(self): +self.assertContains(enwiki_help_editing, uNaming and_moving) +self.assertContains(enwiki_help_editing, u Naming and_moving ) +self.assertContains(enwiki_help_editing, u Naming and_moving_) + +def test_link_in_section(self): +# section is ==[[Wiki markup]]== +self.assertContains(enwiki_help_editing, u[[Wiki markup]], Link as section header) +self.assertContains(enwiki_help_editing, u[[:Wiki markup]], section header link with preleading colon) +self.assertNotContains(enwiki_help_editing, uWiki markup, section header must be a link) +# section is ===[[:Help]]ful tips=== +self.assertContains(enwiki_help_editing, u[[Help]]ful tips, Containing link) +self.assertContains(enwiki_help_editing, u[[:Help]]ful tips, Containing link with preleading colon) +self.assertNotContains(enwiki_help_editing, uHelpful tips, section header must contain a link) + + if __name__ == '__main__': try: unittest.main() -- To view, visit https://gerrit.wikimedia.org/r/120213 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icdd03b9bb5340ed1cad2e8e6f11f65b52495c57d Gerrit-PatchSet: 2 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: Xqt i...@gno.de Gerrit-Reviewer: Ladsgroup ladsgr...@gmail.com Gerrit-Reviewer: Legoktm legoktm.wikipe...@gmail.com