jenkins-bot has submitted this change and it was merged.
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(-)
Approvals: Merlijn van Deen: Looks good to me, approved jenkins-bot: Verified
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):
pywikibot-commits@lists.wikimedia.org