jenkins-bot has submitted this change and it was merged.
Change subject: Wikidata is now its own client
......................................................................
Wikidata is now its own client
Update Wikidata family configuration.
Existing tests need to be updated as they verified that the Wikidata
site was not a client, which is no longer true.
Change-Id: If98313a6ca79d660d68b9cfc5a990d68218430ec
---
M pywikibot/families/wikidata_family.py
M tests/wikibase_tests.py
2 files changed, 25 insertions(+), 21 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/families/wikidata_family.py
b/pywikibot/families/wikidata_family.py
index cccc614..2e33e5b 100644
--- a/pywikibot/families/wikidata_family.py
+++ b/pywikibot/families/wikidata_family.py
@@ -17,14 +17,17 @@
}
def shared_data_repository(self, code, transcluded=False):
- """Always return a repository tupe. This enables testing whether
- the site object is the repository itself, see Site.is_data_repository()
-
"""
- if transcluded:
- return (None, None)
- else:
- return (code, self.name)
+ Indicate Wikidata is both a repository and its own client.
+
+ Until 20 August 2014, Wikidata was only a data repository,
+ and this method only returned a tuple with data if
+ transcluded was False.
+
+ On that date, the software was enhanced so that Wikidata
+ could store sitelinks to itself.
+ """
+ return (code, self.name)
def calendarmodel(self, code):
"""Default calendar model for WbTime datatype"""
diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index 0f1cba9..05dd97b 100644
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -127,21 +127,23 @@
'species.*no transcluded data',
self.wdp.data_item)
- # test.wikidata does not have a data repository.
- self.wdp = pywikibot.ItemPage(wikidatatest, 'Q6')
- self.assertRaises(pywikibot.WikiBaseError,
- pywikibot.ItemPage.fromPage, self.wdp)
+ def test_own_client(self):
+ """Test that a data repository family can be its own
client."""
+ # Note: these tests do not yet verify that pywikibot can
+ # utilise this Wikibase configuration, as it is not yet
+ # working correctly on Wikidata.
- # The main Wikidata also does not have a data repository.
- # It is a data repository, but no pages on Wikidata have
- # a linked page.
- self.wdp = pywikibot.ItemPage(wikidata, 'Q60')
- self.assertRaises(pywikibot.WikiBaseError,
- pywikibot.ItemPage.fromPage, self.wdp)
+ # The main Wikidata is its own client.
+ self.wdp = pywikibot.ItemPage(wikidata,
+ wikidata.siteinfo['mainpage'])
+ item = pywikibot.ItemPage.fromPage(self.wdp)
+ del item
- self.wdp = pywikibot.Page(wikidata, 'Main Page', ns=4)
- self.assertRaises(pywikibot.WikiBaseError,
- pywikibot.ItemPage.fromPage, self.wdp)
+ # test.wikidata is also
+ self.wdp = pywikibot.ItemPage(wikidatatest,
+ wikidatatest.siteinfo['mainpage'])
+ item = pywikibot.ItemPage.fromPage(self.wdp)
+ del item
class TestItemLoad(PywikibotTestCase):
@@ -413,7 +415,6 @@
def test_page_methods(self):
"""Test ItemPage methods inherited from superclass
Page."""
self.wdp = pywikibot.ItemPage(wikidatatest, 'Q6')
- self.assertRaises(pywikibot.WikiBaseError, self.wdp.data_item)
self.assertRaises(pywikibot.PageNotSaved, self.wdp.save)
self.wdp.previousRevision()
self.assertEquals(self.wdp.langlinks(), [])
--
To view, visit
https://gerrit.wikimedia.org/r/155225
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If98313a6ca79d660d68b9cfc5a990d68218430ec
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>