http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9200
Revision: 9200 Author: jayvdb Date: 2011-04-26 00:40:11 +0000 (Tue, 26 Apr 2011) Log Message: ----------- Fix testcases
Modified Paths: -------------- trunk/pywikipedia/tests/test_textlib.py
Modified: trunk/pywikipedia/tests/test_textlib.py =================================================================== --- trunk/pywikipedia/tests/test_textlib.py 2011-04-25 15:02:45 UTC (rev 9199) +++ trunk/pywikipedia/tests/test_textlib.py 2011-04-26 00:40:11 UTC (rev 9200) @@ -14,7 +14,8 @@
class PyWikiTextLibTestCase(PyWikiTestCase):
- result1 = '[[Category:Cat1]]\r\n[[Category:Cat2]]\r\n' + catresult1 = '[[Category:Cat1]]\r\n[[Category:Cat2]]\r\n' + result1 = catresult1.strip()
def setUp(self): self.site = pywikibot.getSite('en', 'wikipedia') @@ -22,23 +23,23 @@ catlib.Category(self.site, 'Category:Cat2')]
def test_categoryFormat_raw(self): - self.assertEqual(self.result1, + self.assertEqual(self.catresult1, textlib.categoryFormat(['[[Category:Cat1]]', '[[Category:Cat2]]'], self.site))
def test_categoryFormat_bare(self): - self.assertEqual(self.result1, + self.assertEqual(self.catresult1, textlib.categoryFormat(['Cat1', 'Cat2'], self.site))
def test_categoryFormat_Category(self): - self.assertEqual(self.result1, + self.assertEqual(self.catresult1, textlib.categoryFormat(self.data, self.site))
def test_categoryFormat_Page(self): data = [pywikibot.Page(self.site, 'Category:Cat1'), pywikibot.Page(self.site, 'Category:Cat2')] - self.assertEqual(self.result1, textlib.categoryFormat(self.data, + self.assertEqual(self.catresult1, textlib.categoryFormat(self.data, self.site))
def assertEqualCategoryRoundtrip(self, text, catcount): @@ -52,11 +53,11 @@ self.assertEqualCategoryRoundtrip(self.result1,2)
def test_replaceCategoryLinks1(self): - result = 'Blah\r\n\r\n[[Category:Cat1]]\r\n[[Category:Cat2]]\r\n' + result = 'Blah\r\n\r\n[[Category:Cat1]]\r\n[[Category:Cat2]]' self.assertEqualCategoryRoundtrip(result,2)
def test_replaceCategoryLinks2(self): - result = 'Blah\r\n\r\n[[Category:Cat1]]\r\n[[Category:Cat2]]\r\n\r\n[[fr:Test]]\r\n' + result = 'Blah\r\n\r\n[[Category:Cat1]]\r\n[[Category:Cat2]]\r\n\r\n[[fr:Test]]' self.assertEqualCategoryRoundtrip(result,2)
if __name__ == "__main__":
pywikipedia-svn@lists.wikimedia.org