jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1069624?usp=email )

Change subject: Add title function to MediaInfo.
......................................................................

Add title function to MediaInfo.

Added missing title function to MediaInfo so
it is consistent with other entity types.

Bug: T366424
Change-Id: I9ca83d8854e04e1651bc959cf020ce9799a7fefc
---
M pywikibot/page/_wikibase.py
M tests/file_tests.py
2 files changed, 11 insertions(+), 0 deletions(-)

Approvals:
  jenkins-bot: Verified
  Multichill: Looks good to me, approved




diff --git a/pywikibot/page/_wikibase.py b/pywikibot/page/_wikibase.py
index b3458f6..5ebe25d 100644
--- a/pywikibot/page/_wikibase.py
+++ b/pywikibot/page/_wikibase.py
@@ -521,6 +521,14 @@
         self._assert_has_id()
         return super().getID(numeric=numeric)

+    def title(self):
+        """
+        Return ID as title of the MediaInfo.
+
+        :return: str: the entity identifier
+        """
+        return self.getID()
+
     def editLabels(self, labels: LANGUAGE_TYPE, **kwargs) -> None:
         """Edit MediaInfo labels (eg. captions).

diff --git a/tests/file_tests.py b/tests/file_tests.py
index dc710ad..63b693b 100755
--- a/tests/file_tests.py
+++ b/tests/file_tests.py
@@ -362,6 +362,7 @@
         self.assertEqual('-1', item.id)
         item.get()
         self.assertEqual('M14634781', item.id)
+        self.assertEqual('M14634781', item.title())
         self.assertIsInstance(
             item.labels, pywikibot.page._collections.LanguageDict)
         self.assertIsInstance(
@@ -401,6 +402,8 @@
         with self.assertRaises(NoWikibaseEntityError):
             item.get()
         with self.assertRaises(NoWikibaseEntityError):
+            item.title()
+        with self.assertRaises(NoWikibaseEntityError):
             item.labels

     def test_data_item_when_file_exist_but_without_item(self):

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1069624?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I9ca83d8854e04e1651bc959cf020ce9799a7fefc
Gerrit-Change-Number: 1069624
Gerrit-PatchSet: 1
Gerrit-Owner: Aurorakiitaja <mikanprojek...@gmail.com>
Gerrit-Reviewer: Matěj Suchánek <matejsuchane...@gmail.com>
Gerrit-Reviewer: Multichill <maar...@mdammers.nl>
Gerrit-Reviewer: jenkins-bot
Gerrit-CC: Xqt <i...@gno.de>
Gerrit-CC: Zache-tool <kimmo.virta...@gmail.com>
_______________________________________________
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org

Reply via email to