jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/370426 )
Change subject: [TEST] Add tests for Page.page_image() ......................................................................
[TEST] Add tests for Page.page_image()
Bug: T172625 Change-Id: I8418259c4e504e3fe1d50dbca867af72f3c59852 --- M tests/page_tests.py 1 file changed, 13 insertions(+), 0 deletions(-)
Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved
diff --git a/tests/page_tests.py b/tests/page_tests.py index 56e4662..d6698ce 100644 --- a/tests/page_tests.py +++ b/tests/page_tests.py @@ -550,6 +550,19 @@ page_d3 = pywikibot.Page(site, 'User:Sn1per/ProtectTest1/test/test') self.assertEqual(page_d3.depth, 3)
+ def test_page_image(self): + """ + Test C{Page.page_image} function. + + Since we are not sure what the wiki will return, we mainly test types + """ + site = self.get_site() + mainpage = self.get_mainpage() + image = pywikibot.FilePage(site, 'File:Jean-Léon Gérôme 003.jpg') + self.assertIsInstance(mainpage.page_image(), pywikibot.FilePage) + # for file pages, the API should return the file itself + self.assertEqual(image.page_image(), image) +
class TestPageDeprecation(DefaultSiteTestCase, DeprecationTestCase):
pywikibot-commits@lists.wikimedia.org