jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1089010?usp=email )
Change subject: tests: fix TestItemLoad tests after the label was changed
......................................................................
tests: fix TestItemLoad tests after the label was changed
Bug: T379484
Change-Id: Ia01ac9c18d8c453e1800c3bc67397bfe304dc9a7
---
M tests/wikibase_tests.py
1 file changed, 6 insertions(+), 5 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index 8829eeb..dfb4518 100755
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -285,7 +285,8 @@
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 @@
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 @@
# 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.
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1089010?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ia01ac9c18d8c453e1800c3bc67397bfe304dc9a7
Gerrit-Change-Number: 1089010
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]