jenkins-bot has submitted this change and it was merged.
Change subject: Add some textlib tests
......................................................................
Add some textlib tests
Tests for unescaping
Tests for removing categories via replaceCategoryLinks
Change-Id: I9fe56ae65fe29cd8cebf9563bf6ac691e46b028d
---
M tests/textlib_tests.py
1 file changed, 19 insertions(+), 0 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
XZise: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/tests/textlib_tests.py b/tests/textlib_tests.py
index f450455..1aceb5d 100644
--- a/tests/textlib_tests.py
+++ b/tests/textlib_tests.py
@@ -224,6 +224,14 @@
new = textlib.replaceCategoryInPlace(temp, dummy, cats[3], site=self.site)
self.assertEqual(self.old, new)
+ # Testing removing categories
+ temp = textlib.replaceCategoryInPlace(self.old, cats[0], None, site=self.site)
+ self.assertNotEqual(temp, self.old)
+ temp_cats = textlib.getCategoryLinks(temp, site=self.site)
+ self.assertNotIn(cats[0], temp_cats)
+ # First and third categories are the same
+ self.assertEqual([cats[1], cats[3]], temp_cats)
+
new_cats = textlib.getCategoryLinks(new, site=self.site)
self.assertEqual(cats, new_cats)
@@ -1222,6 +1230,17 @@
self.assertEqual(set(lang_links), self.sites_set - set([self.site]))
+class TestUnescape(TestCase):
+
+ """Test to verify that unescaping HTML chars are correctly
done."""
+
+ net = False
+
+ def test_unescape(self):
+ """Test unescaping HTML chars."""
+
self.assertEqual(textlib.unescape('!23<>'"&&'),
+ '!23<>\'"&&')
+
if __name__ == '__main__':
try:
unittest.main()
--
To view, visit
https://gerrit.wikimedia.org/r/247545
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9fe56ae65fe29cd8cebf9563bf6ac691e46b028d
Gerrit-PatchSet: 3
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>