John Vandenberg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/243250

Change subject: [FIX] Stop crashing item loads due to support of units
......................................................................

[FIX] Stop crashing item loads due to support of units

We need more patches to have better support of quantities with unit
But this needs to be merged ASAP, it crashes loading of every item with
claims with units in them (more than 10K items)

Bug: T112130
Change-Id: Iff7c9ad0e9cd2ec728595f900279e82848d9a0de
(cherry picked from commit e2ab72b54b0581490ec205983fa57df19d20aeef)
---
M pywikibot/__init__.py
M tests/wikibase_tests.py
2 files changed, 0 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/50/243250/1

diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index c155035..9571873 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -479,9 +479,6 @@
         """
         if amount is None:
             raise ValueError('no amount given')
-        if unit is not None and unit != '1':
-            raise NotImplementedError(
-                'Currently only unit-less quantities are supported')
         if unit is None:
             unit = '1'
         self.amount = amount
diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index 929dbd1..a1aaf5f 100644
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -128,8 +128,6 @@
         # test WbQuantity error handling
         self.assertRaises(ValueError, pywikibot.WbQuantity, amount=None,
                           error=1)
-        self.assertRaises(NotImplementedError, pywikibot.WbQuantity, 
amount=789,
-                          unit='invalid_unit')
 
 
 class TestItemPageExtensibility(TestCase):

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iff7c9ad0e9cd2ec728595f900279e82848d9a0de
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: 2.0
Gerrit-Owner: John Vandenberg <jay...@gmail.com>

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

Reply via email to