jenkins-bot merged this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
textlib: add tests for sections headers with multiple levels

Change-Id: I25218cc42c40951f7bfca2fa57f2253cb33e3ca3
---
M tests/textlib_tests.py
1 file changed, 29 insertions(+), 0 deletions(-)

diff --git a/tests/textlib_tests.py b/tests/textlib_tests.py
index 187f2b5..990e937 100644
--- a/tests/textlib_tests.py
+++ b/tests/textlib_tests.py
@@ -1739,6 +1739,35 @@
('text\n\n', [('==title==', '\ncontent\n')], '[[Category:A]]\n')
)

+ def test_with_h1_and_h2_sections(self):
+ """Test for text having h1 and h2 sections."""
+ self.assertEqual(
+ extract_sections(
+ 'text\n\n'
+ '=first level=\n'
+ 'foo\n'
+ '==title==\n'
+ 'bar',
+ self.site),
+ ('text\n\n',
+ [('=first level=', '\nfoo\n'), ('==title==', '\nbar')],
+ '')
+ )
+
+ def test_with_h4_and_h2_sections(self):
+ """Test for text having h4 and h2 sections."""
+ self.assertEqual(
+ extract_sections(
+ 'text\n\n'
+ '====title====\n'
+ '==title 2==\n'
+ 'content',
+ self.site),
+ ('text\n\n',
+ [('====title====', '\n'), ('==title 2==', '\ncontent')],
+ '')
+ )
+

if __name__ == '__main__': # pragma: no cover
try:

To view, visit change 505225. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I25218cc42c40951f7bfca2fa57f2253cb33e3ca3
Gerrit-Change-Number: 505225
Gerrit-PatchSet: 2
Gerrit-Owner: Whym <whym@whym.org>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Siebrand <siebrand@kitano.nl>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot (75)