jenkins-bot has submitted this change and it was merged.
Change subject: Add tests for Category redirects ......................................................................
Add tests for Category redirects
Change-Id: I3e7ed4f8ece80f81d533982983da46d175e5d2f1 --- M tests/category_tests.py 1 file changed, 17 insertions(+), 0 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/category_tests.py b/tests/category_tests.py index 9e57069..8923884 100644 --- a/tests/category_tests.py +++ b/tests/category_tests.py @@ -132,6 +132,23 @@ articles_total = list(cat.articles(total=2)) self.assertEqual(len(articles_total), 2)
+ def test_redirects(self): + """Test the redirects method.""" + site = self.get_site() + cat1 = pywikibot.Category(site, 'Category:Fonts') + cat2 = pywikibot.Category(site, 'Category:Typefaces') + + self.assertTrue(cat1.isCategoryRedirect()) + self.assertFalse(cat2.isCategoryRedirect()) + + # The correct target category if fetched. + tgt = cat1.getCategoryRedirectTarget() + self.assertEqual(tgt, cat2) + + # Raise exception if target is fetched for non Category redirects. + self.assertRaises(pywikibot.IsNotRedirectPage, + cat2.getCategoryRedirectTarget) +
class TestCategoryDryObject(TestCase):
pywikibot-commits@lists.wikimedia.org