Strainu has uploaded a new change for review. ( 
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(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/26/370426/1

diff --git a/tests/page_tests.py b/tests/page_tests.py
index 56e4662..a732c02 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()
+        file = pywikibot.FilePage(site, u"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(file.page_image(), file)
+
 
 class TestPageDeprecation(DefaultSiteTestCase, DeprecationTestCase):
 

-- 
To view, visit https://gerrit.wikimedia.org/r/370426
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8418259c4e504e3fe1d50dbca867af72f3c59852
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Strainu <w...@strainu.ro>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to