Running the test
pwb -user:<username> PYWIKIBOT_TEST_WRITE wikibase_edit_tests -v TestWikibaseMakeClaim.test_musical_notation_edit
fails with the following error:
tests: max_retries reduced from 15 to 3 test_musical_notation_edit (__main__.TestWikibaseMakeClaim.test_musical_notation_edit) Attempt adding a musical notation claim with valid input. ... ERROR ====================================================================== ERROR: test_musical_notation_edit (__main__.TestWikibaseMakeClaim.test_musical_notation_edit) Attempt adding a musical notation claim with valid input. ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\pwb\GIT\core\pywikibot\page\_decorators.py", line 35, in handle func(self, *args, **kwargs) ~~~~^^^^^^^^^^^^^^^^^^^^^^^ File "D:\pwb\GIT\core\pywikibot\page\_wikibase.py", line 905, in addClaim self.repo.addClaim(self, claim, bot=bot, **kwargs) ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\pwb\GIT\core\pywikibot\site\_decorators.py", line 86, in callee return fn(self, *args, **kwargs) ~~^^^^^^^^^^^^^^^^^^^^^^^ File "D:\pwb\GIT\core\pywikibot\site\_datasite.py", line 353, in addClaim data = req.submit() ~~~~~~~~~~^^ File "D:\pwb\GIT\core\pywikibot\data\api\_requests.py", line 1122, in submit raise pywikibot.exceptions.APIError(**args) pywikibot.exceptions.APIError: modification-failed: String should not start or end with whitespace nor include vertical whitespace or tabs: elative c' { c d e f | g2 g | a4 a a a | g1 |}) [param: action=wbsetclaim&claim=%7B%22mainsnak%22%3A+%7B%22snaktype%22%3A+%22value%22%2C+%22property%22%3A+%22P88936%22%2C+%22datatype%22%3A+%22musical-notation%22%2C+%22datavalue%22%3A+%7B%22value%22%3A+%22%5Crelative+c%27+%7B+c+d+e+f+%7C+g2+g+%7C+a4+a+a+a+%7C+g1+%7C%7D%29%22%2C+%22type%22%3A+%22string%22%7D%7D%2C+%22type%22%3A+%22statement%22%2C+%22id%22%3A+%22Q68%2430e5af6e-1f88-4bba-be69-c9e9fc846b65%22%2C+%22rank%22%3A+%22normal%22%7D&baserevid=664705&bot=&assert=user&maxlag=5&format=json&token=af089a00c65629821a359e4bd07db151662660d5%2B%5C; messages: [{'name': 'wikibase-validator-illegal-string-chars', 'parameters': ["\relative c' { c d e f | g2 g | a4 a a a | g1 |})"], 'html': {'*': "Die Zeichenfolge darf nicht mit Leerzeichen beginnen oder enden und auch keine vertikalen Leerzeichen oder Tabulatoren enthalten: \relative c' { c d e f | g2 g | a4 a a a | g1 |})"}}]; servedby: mw-api-ext.eqiad.main-6748bf4564-ffr8t; help: See https://test.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/> for notice of API deprecations and breaking changes.] During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:\pwb\GIT\core\tests\wikibase_edit_tests.py", line 426, in test_musical_notation_edit item.addClaim(claim) ~~~~~~~~~~~~~^^^^^^^ File "D:\pwb\GIT\core\pywikibot\page\_decorators.py", line 55, in wrapper handle(func, self, *args, **kwargs) ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\pwb\GIT\core\pywikibot\page\_decorators.py", line 47, in handle raise OtherPageSaveError(self, err) pywikibot.exceptions.OtherPageSaveError: Edit to page [[wikidata:test:Q68]] failed: modification-failed: String should not start or end with whitespace nor include vertical whitespace or tabs: elative c' { c d e f | g2 g | a4 a a a | g1 |}) [param: action=wbsetclaim&claim=%7B%22mainsnak%22%3A+%7B%22snaktype%22%3A+%22value%22%2C+%22property%22%3A+%22P88936%22%2C+%22datatype%22%3A+%22musical-notation%22%2C+%22datavalue%22%3A+%7B%22value%22%3A+%22%5Crelative+c%27+%7B+c+d+e+f+%7C+g2+g+%7C+a4+a+a+a+%7C+g1+%7C%7D%29%22%2C+%22type%22%3A+%22string%22%7D%7D%2C+%22type%22%3A+%22statement%22%2C+%22id%22%3A+%22Q68%2430e5af6e-1f88-4bba-be69-c9e9fc846b65%22%2C+%22rank%22%3A+%22normal%22%7D&baserevid=664705&bot=&assert=user&maxlag=5&format=json&token=af089a00c65629821a359e4bd07db151662660d5%2B%5C; messages: [{'name': 'wikibase-validator-illegal-string-chars', 'parameters': ["\relative c' { c d e f | g2 g | a4 a a a | g1 |})"], 'html': {'*': "Die Zeichenfolge darf nicht mit Leerzeichen beginnen oder enden und auch keine vertikalen Leerzeichen oder Tabulatoren enthalten: \relative c' { c d e f | g2 g | a4 a a a | g1 |})"}}]; servedby: mw-api-ext.eqiad.main-6748bf4564-ffr8t; help: See https://test.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/> for notice of API deprecations and breaking changes.] ---------------------------------------------------------------------- Ran 1 test in 5.842s FAILED (errors=1)
The problem might be that \r is a line feed. Changin it to \\r the wikibase entry fails:
line 1 - column 49: syntax error, unexpected EVENT_IDENTIFIER, expecting '}' -------- line 7 - column 1: syntax error, unexpected '}'
see https://test.wikidata.org/w/index.php?title=Q68&diff=next&oldid=664705