jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/335995 )
Change subject: Fix AttributeError on Travis
......................................................................
Fix AttributeError on Travis
This reverts commit 829637ffda7525d8aa25d09e8b26a0e1cf079a94.
Bug: T157188
Change-Id: I29e64651af99b2829651373dfd0077aefa02d54b
---
M pywikibot/page.py
M pywikibot/site.py
M tests/wikibase_tests.py
3 files changed, 4 insertions(+), 51 deletions(-)
Approvals:
jenkins-bot: Verified
Sn1per: Looks good to me, approved
diff --git a/pywikibot/page.py b/pywikibot/page.py
index c83e1bd..f015e45 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -12,7 +12,7 @@
"""
#
-# (C) Pywikibot team, 2008-2017
+# (C) Pywikibot team, 2008-2016
#
# Distributed under the terms of the MIT license.
#
@@ -4274,17 +4274,6 @@
if not hasattr(self, '_type'):
self._type = self.repo.getPropertyType(self)
return self._type
-
- @property
- def labels(self):
- """
- Return labels of this property.
-
- @rtype: dict
- """
- if not hasattr(self, '_labels'):
- self._labels = self.repo.get_property_labels(self)
- return self._labels
@deprecated("Property.type")
def getType(self):
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 2cb14f1..2491a54 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -6,7 +6,7 @@
groups of wikis on the same topic in different languages.
"""
#
-# (C) Pywikibot team, 2008-2017
+# (C) Pywikibot team, 2008-2016
#
# Distributed under the terms of the MIT license.
#
@@ -7243,30 +7243,6 @@
dtype = data['entities'][prop.getID()]['datatype']
except KeyError:
dtype = data['entities'][prop.getID().lower()]['datatype']
-
- return dtype
-
- def get_property_labels(self, prop):
- """
- Obtain labels of a property.
-
- Results are cached for 1 day.
- """
- params = dict(
- action='wbgetentities',
- ids=prop.getID(),
- props='labels',
- )
- expiry = datetime.timedelta(days=1)
- req = self._request(expiry=expiry, parameters=params)
- data = req.submit()
-
- # the IDs returned from the API can be upper or lowercase, depending
- # on the version. See bug T55894 for more information.
- try:
- dtype = data['entities'][prop.getID()]['labels']
- except KeyError:
- dtype = data['entities'][prop.getID().lower()]['labels']
return dtype
diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index 70aaa22..0aaad45 100644
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Tests for the Wikidata parts of the page module."""
#
-# (C) Pywikibot team, 2008-2017
+# (C) Pywikibot team, 2008-2016
#
# Distributed under the terms of the MIT license.
#
@@ -18,7 +18,7 @@
import pywikibot
from pywikibot import pagegenerators
-from pywikibot.page import WikibasePage, ItemPage, Property, PropertyPage
+from pywikibot.page import WikibasePage, ItemPage, PropertyPage
from pywikibot.site import Namespace, NamespacesDict
from pywikibot.tools import MediaWikiVersion
@@ -716,18 +716,6 @@
self.assertTrue(item.isRedirectPage())
target = pywikibot.ItemPage(wikidata, 'Q8422626')
self.assertEqual(item.getRedirectTarget(), target)
-
-
-class TestProperty(WikidataTestCase):
-
- """Test Property."""
-
- def test_labels(self):
- """Test retrieving Property labels."""
- wikidata = self.get_repo()
- property = Property(wikidata, 'P625')
- expected = {'language': 'en', 'value': 'coordinate
location'}
- self.assertDictEqual(property.labels['en'], expected)
class TestPropertyPage(WikidataTestCase):
--
To view, visit
https://gerrit.wikimedia.org/r/335995
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I29e64651af99b2829651373dfd0077aefa02d54b
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Phantom42 <nikitav30(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Sn1per <geofbot(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>