jenkins-bot has submitted this change and it was merged.
Change subject: Fix: test_no_qualifiers failing due to Coordinate's precision
......................................................................
Fix: test_no_qualifiers failing due to Coordinate's precision
Return None instead of a ValueError when both
dim and precision are set to None in Coordinate.
Bug: T129834
Change-Id: I258629a6e75207322a94d5312e7eb6225f11c572
---
M pywikibot/__init__.py
M tests/wikibase_tests.py
2 files changed, 1 insertion(+), 3 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 74ad87c..c80c9e1 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -355,7 +355,7 @@
@rtype: float or None
"""
if self._dim is None and self._precision is None:
- raise ValueError('No values set for dim or precision')
+ return None
if self._precision is None and self._dim is not None:
radius = 6378137 # TODO: Support other globes
self._precision = math.degrees(
diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index a0d8265..7b747e3 100644
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -155,8 +155,6 @@
self.assertIsInstance(y.precision, float)
z = pywikibot.Coordinate(site=repo, lat=12.0, lon=13.0)
with self.assertRaises(ValueError):
- z.precision
- with self.assertRaises(ValueError):
z.precisionToDim()
def test_WbTime(self):
--
To view, visit
https://gerrit.wikimedia.org/r/277277
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I258629a6e75207322a94d5312e7eb6225f11c572
Gerrit-PatchSet: 6
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Darthbhyrava <hbhyrava(a)gmail.com>
Gerrit-Reviewer: Darthbhyrava <hbhyrava(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>