Xqt created this task.
Xqt added projects: Pywikibot, Pywikibot-tests, Pywikibot-Wikidata.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.
TASK DESCRIPTION
test_load_item_set_id and test_reuse_item_set_id tests of
wikibase_tests.TestItemLoad fails recently:
10:50:20 =================================== FAILURES
===================================
10:50:20 ______________________ TestItemLoad.test_load_item_set_id
______________________
10:50:20
10:50:20 self = <tests.wikibase_tests.TestItemLoad
testMethod=test_load_item_set_id>
10:50:20
10:50:20 def test_load_item_set_id(self) -> None:
10:50:20 """Test setting item.id attribute on empty item."""
10:50:20 wikidata = self.get_repo()
10:50:20 item = ItemPage(wikidata, '-1')
10:50:20 self.assertEqual(item._link._title, '-1')
10:50:20 item.id = 'Q60'
10:50:20 self.assertNotHasAttr(item, '_content')
10:50:20 self.assertEqual(item.getID(), 'Q60')
10:50:20 self.assertNotHasAttr(item, '_content')
10:50:20 item.get()
10:50:20 self.assertHasAttr(item, '_content')
10:50:20 > self.assertIn('mul', item.labels)
10:50:20 E AssertionError: 'mul' not found in LanguageDict({'ab':
'Ниу-Иорк', 'acm': 'نيويورك', 'af': 'New York', 'am': 'ኒው ዮርክ', ...})
10:50:20
10:50:20 tests/wikibase_tests.py:286: AssertionError
10:50:20 _____________________ TestItemLoad.test_reuse_item_set_id
______________________
10:50:20
10:50:20 self = <tests.wikibase_tests.TestItemLoad
testMethod=test_reuse_item_set_id>
10:50:20
10:50:20 def test_reuse_item_set_id(self) -> None:
10:50:20 """Test modifying item.id attribute.
10:50:20
10:50:20 Some scripts are using item.id = 'Q60' semantics, which
does
10:50:20 work but modifying item.id does not currently work, and
this
10:50:20 test highlights that it breaks silently.
10:50:20 """
10:50:20 # label could change
10:50:20 label = ['New York', 'New York City']
10:50:20 wikidata = self.get_repo()
10:50:20 item = ItemPage(wikidata, 'Q60')
10:50:20 item.get()
10:50:20 > self.assertIn(item.labels['mul'], label)
10:50:20 ^^^^^^^^^^^^^^^^^^
10:50:20
10:50:20 tests/wikibase_tests.py:303:
10:50:20 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _
10:50:20
10:50:20 self = LanguageDict({'ab': 'Ниу-Иорк', 'acm': 'نيويورك', 'af':
'New York', 'am': 'ኒው ዮርክ', ...})
10:50:20 key = 'mul'
10:50:20
10:50:20 def __getitem__(self, key: BaseSite | str) -> Any:
10:50:20 key = self.normalizeKey(key)
10:50:20 > return self._data[key]
10:50:20 ^^^^^^^^^^^^^^^
10:50:20 E KeyError: 'mul'
10:50:20
10:50:20 pywikibot/page/_collections.py:48: KeyError
The reason was this change
<https://www.wikidata.org/w/index.php?title=Q60&action=history> on WD item
`Q60` due to Help: Default values for labels and aliases
<https://www.wikidata.org/wiki/Help:Default_values_for_labels_and_aliases>
See also T402084 <https://phabricator.wikimedia.org/T402084>
TASK DETAIL
https://phabricator.wikimedia.org/T412188
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]