From 83197e14a6c64cb49938a53d4d0eaec1cfe06531 Mon Sep 17 00:00:00 2001 From: xqt Date: Sun, 10 Nov 2024 09:49:35 +0100 Subject: [PATCH] tests: fix TestItemLoad tests after the label was changed Bug: T379484 Change-Id: Ia01ac9c18d8c453e1800c3bc67397bfe304dc9a7 --- tests/wikibase_tests.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py index 8829eeb459..dfb45183e2 100755 --- a/tests/wikibase_tests.py +++ b/tests/wikibase_tests.py @@ -285,7 +285,8 @@ def test_load_item_set_id(self): item.get() self.assertTrue(hasattr(item, '_content')) self.assertIn('en', item.labels) - self.assertEqual(item.labels['en'], 'New York City') + # label could change + self.assertIn(item.labels['en'], ['New York', 'New York City']) self.assertEqual(item.title(), 'Q60') def test_reuse_item_set_id(self): @@ -295,10 +296,12 @@ def test_reuse_item_set_id(self): but modifying item.id does not currently work, and this test highlights that it breaks silently. """ + # label could change + label = ['New York', 'New York City'] wikidata = self.get_repo() item = ItemPage(wikidata, 'Q60') item.get() - self.assertEqual(item.labels['en'], 'New York City') + self.assertIn(item.labels['en'], label) # When the id attribute is modified, the ItemPage goes into # an inconsistent state. @@ -310,9 +313,7 @@ def test_reuse_item_set_id(self): # it doesn't help to clear this piece of saved state. del item._content # The labels are not updated; assertion showing undesirable behaviour: - self.assertEqual(item.labels['en'], 'New York City') - # TODO: This is the assertion that this test should be using: - # self.assertTrue(item.labels['en'].lower().endswith('main page')) + self.assertIn(item.labels['en'], label) def test_empty_item(self): """Test empty wikibase item.