Skip to content

Commit

Permalink
Merge "tests: fix TestItemLoad tests after the label was changed"
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Nov 10, 2024
2 parents 1e37bd9 + 83197e1 commit 8eed00b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/wikibase_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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.
Expand All @@ -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.
Expand Down

0 comments on commit 8eed00b

Please sign in to comment.