jenkins-bot has submitted this change and it was merged.
Change subject: Fix tests to work with user config site fr.wikt ......................................................................
Fix tests to work with user config site fr.wikt
Two wikibase test cases assumed that the config specified wiki has a data repository.
One page test didnt specify a source for a Link( ), so it defaulted to the config site, which in the case of wikt behaves differently to the expectations of the test writer.
Change-Id: Ic8075275e52b9cbbf8a3d24164be7ab665b97ed0 --- M tests/page_tests.py M tests/wikibase_tests.py 2 files changed, 6 insertions(+), 4 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
Objections: Ricordisamoa: There's a problem with this change, please improve
diff --git a/tests/page_tests.py b/tests/page_tests.py index c9f02e2..4948638 100644 --- a/tests/page_tests.py +++ b/tests/page_tests.py @@ -83,10 +83,12 @@ """Test that Link() normalizes titles""" for title in self.titles: for num in (0, 1): - l = pywikibot.page.Link(self.namespaces[num][0] + title) + l = pywikibot.page.Link(self.namespaces[num][0] + title, + self.enwiki) self.assertEqual(l.title, self.titles[title]) # prefixing name with ":" shouldn't change result - m = pywikibot.page.Link(":" + self.namespaces[num][0] + title) + m = pywikibot.page.Link(":" + self.namespaces[num][0] + title, + self.enwiki) self.assertEqual(m.title, self.titles[title])
def testHashCmp(self): diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py index f30ded4..a9142dd 100644 --- a/tests/wikibase_tests.py +++ b/tests/wikibase_tests.py @@ -396,7 +396,7 @@ def test_set_date(self): claim = pywikibot.Claim(wikidata, 'P569') self.assertEquals(claim.type, 'time') - claim.setTarget(pywikibot.WbTime(year=2001, month=01, day=01)) + claim.setTarget(pywikibot.WbTime(year=2001, month=01, day=01, site=wikidata)) self.assertEquals(claim.target.year, 2001) self.assertEquals(claim.target.month, 1) self.assertEquals(claim.target.day, 1) @@ -405,7 +405,7 @@ claim = pywikibot.Claim(wikidata, 'P569') self.assertRaises(ValueError, claim.setTarget, 'foo') claim = pywikibot.Claim(wikidata, 'P856') - self.assertRaises(ValueError, claim.setTarget, pywikibot.WbTime(2001)) + self.assertRaises(ValueError, claim.setTarget, pywikibot.WbTime(2001, site=wikidata))
class TestPageMethods(PywikibotTestCase):
pywikibot-commits@lists.wikimedia.org