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):
--
To view, visit
https://gerrit.wikimedia.org/r/370426
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8418259c4e504e3fe1d50dbca867af72f3c59852
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Strainu <wiki(a)strainu.ro>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>