ArthurPSmith added a comment. |
As far as testing goes, I have (in my own copy) added the following to the pywikibot tests/wikibase_edit_tests.py file (within the class TestWikibaseMakeClaim):
def _check_quantity_claim(self, value, uncertainty): """Helper function to add and check quantity claims""" testsite = self.get_repo() item = self._clean_item(testsite, 'P64')
# set new claim claim = pywikibot.page.Claim(testsite, 'P64', datatype='quantity') target = pywikibot.WbQuantity(value, error=uncertainty) claim.setTarget(target) item.addClaim(claim) item.get(force=True) claim = item.claims['P64'][0] self.assertEqual(claim.getTarget(), target) def test_medium_quantity_edit(self): """Attempt to add medium-size quantity claim.""" self._check_quantity_claim(1.5, 0.1) def test_small_quantity_edit(self): """Attempt to add very small quantity claim.""" self._check_quantity_claim(1.0e-7, 2.0e-8) def test_large_quantity_edit(self): """Attempt to add large quantity claim.""" self._check_quantity_claim(1.935e35, 1e32) def test_negative_quantity_edit(self): """Attempt to add negative quantity claims.""" self._check_quantity_claim(-1.5, 0.1)
When these tests are run via
python pwb.py tests/wikibase_edit_tests.py -v
both test_large_quantity_edit() and test_small_quantity_edit fail, with messages:
Attempt to add large quantity claim. ... WARNING: API error invalid-snak: Invalid snack (Value must match the pattern for decimal values.)
Attempt to add very small quantity claim. ... WARNING: API error invalid-snak: Invalid snak. (Value must match the pattern for decimal values.)
TASK DETAIL
EMAIL PREFERENCES
To: ArthurPSmith
Cc: Tobias1984, Aklapper, StudiesWorld, pywikibot-bugs-list, ArthurPSmith, Mdupont, D3r1ck01, Izno, Wikidata-bugs, aude, jayvdb, Ricordisamoa, Mbch331
Cc: Tobias1984, Aklapper, StudiesWorld, pywikibot-bugs-list, ArthurPSmith, Mdupont, D3r1ck01, Izno, Wikidata-bugs, aude, jayvdb, Ricordisamoa, Mbch331
_______________________________________________ Wikidata-bugs mailing list Wikidata-bugs@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs