jenkins-bot merged this change.
site_tests.TestSiteObject: Handle obsolete site codes
Site constructor automatically replaces obsolete site codes with their new
replacements if available.[1] This causes test failures on travis builds
for nb:wikipedia.
[1]:
https://phabricator.wikimedia.org/diffusion/PWBC/browse/master/pywikibot/site.py;a28e8b0fab915a9f63babc631e7c5ac35d924d44$748
Bug: T193518
Change-Id: I3539de9eff867d315aee64cd418455c239725e4a
---
M tests/site_tests.py
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/site_tests.py b/tests/site_tests.py
index b20bb8a..62ff953 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -266,20 +266,20 @@
def test_repr(self):
"""Test __repr__."""
- expect = 'Site("{0}", "{1}")'.format(self.code, self.family)
+ code = self.site.family.obsolete.get(self.code) or self.code
+ expect = 'Site("{0}", "{1}")'.format(code, self.family)
self.assertStringMethod(str.endswith, repr(self.site), expect)
def test_base_methods(self):
"""Test cases for BaseSite methods."""
mysite = self.get_site()
+ code = self.site.family.obsolete.get(self.code) or self.code
self.assertEqual(mysite.family.name, self.family)
- self.assertEqual(mysite.code, self.code)
+ self.assertEqual(mysite.code, code)
self.assertIsInstance(mysite.lang, basestring)
self.assertEqual(mysite, pywikibot.Site(self.code, self.family))
self.assertIsInstance(mysite.user(), (basestring, type(None)))
- self.assertEqual(mysite.sitename(),
- "%s:%s" % (self.family,
- self.code))
+ self.assertEqual(mysite.sitename(), '%s:%s' % (self.family, code))
self.assertIsInstance(mysite.linktrail(), basestring)
self.assertIsInstance(mysite.redirect(), basestring)
try:
To view, visit change 430542. To unsubscribe, visit settings.