Revision: 6793 Author: cosoleto Date: 2009-05-02 16:52:09 +0000 (Sat, 02 May 2009)
Log Message: ----------- Renamed. Not absolutely necessary, though.
Added Paths: ----------- trunk/pywikipedia/tests/test_xmlreader.py
Removed Paths: ------------- trunk/pywikipedia/tests/test-xmlreader.py
Deleted: trunk/pywikipedia/tests/test-xmlreader.py =================================================================== --- trunk/pywikipedia/tests/test-xmlreader.py 2009-05-02 16:43:38 UTC (rev 6792) +++ trunk/pywikipedia/tests/test-xmlreader.py 2009-05-02 16:52:09 UTC (rev 6793) @@ -1,38 +0,0 @@ -import xml.sax - -import unittest -import test_utils - -import xmlreader - -class XmlReaderTestCase(unittest.TestCase): - def test_XmlDumpAllRevs(self): - pages = [r for r in xmlreader.XmlDump("data/article-pear.xml", allrevisions=True).parse()] - self.assertEquals(4, len(pages)) - self.assertEquals(u"Automated conversion", pages[0].comment) - self.assertEquals(u"Pear", pages[0].title) - self.assertEquals(u"24278", pages[0].id) - self.assertTrue(pages[0].text.startswith('Pears are [[tree]]s of')) - self.assertEquals(u"Quercusrobur", pages[1].username) - - def test_XmlDumpFirstRev(self): - pages = [r for r in xmlreader.XmlDump("data/article-pear.xml").parse()] - self.assertEquals(1, len(pages)) - self.assertEquals(u"Automated conversion", pages[0].comment) - self.assertEquals(u"Pear", pages[0].title) - self.assertEquals(u"24278", pages[0].id) - self.assertTrue(pages[0].text.startswith('Pears are [[tree]]s of')) - - def test_MediaWikiXmlHandler(self): - handler = xmlreader.MediaWikiXmlHandler() - pages = [] - def pageDone(page): - pages.append(page) - handler.setCallback(pageDone) - xml.sax.parse("data/article-pear.xml", handler) - self.assertEquals(4, len(pages)) - self.assertNotEquals("", pages[0].comment) - - -if __name__ == '__main__': - unittest.main()
Copied: trunk/pywikipedia/tests/test_xmlreader.py (from rev 6792, trunk/pywikipedia/tests/test-xmlreader.py) =================================================================== --- trunk/pywikipedia/tests/test_xmlreader.py (rev 0) +++ trunk/pywikipedia/tests/test_xmlreader.py 2009-05-02 16:52:09 UTC (rev 6793) @@ -0,0 +1,38 @@ +import xml.sax + +import unittest +import test_utils + +import xmlreader + +class XmlReaderTestCase(unittest.TestCase): + def test_XmlDumpAllRevs(self): + pages = [r for r in xmlreader.XmlDump("data/article-pear.xml", allrevisions=True).parse()] + self.assertEquals(4, len(pages)) + self.assertEquals(u"Automated conversion", pages[0].comment) + self.assertEquals(u"Pear", pages[0].title) + self.assertEquals(u"24278", pages[0].id) + self.assertTrue(pages[0].text.startswith('Pears are [[tree]]s of')) + self.assertEquals(u"Quercusrobur", pages[1].username) + + def test_XmlDumpFirstRev(self): + pages = [r for r in xmlreader.XmlDump("data/article-pear.xml").parse()] + self.assertEquals(1, len(pages)) + self.assertEquals(u"Automated conversion", pages[0].comment) + self.assertEquals(u"Pear", pages[0].title) + self.assertEquals(u"24278", pages[0].id) + self.assertTrue(pages[0].text.startswith('Pears are [[tree]]s of')) + + def test_MediaWikiXmlHandler(self): + handler = xmlreader.MediaWikiXmlHandler() + pages = [] + def pageDone(page): + pages.append(page) + handler.setCallback(pageDone) + xml.sax.parse("data/article-pear.xml", handler) + self.assertEquals(4, len(pages)) + self.assertNotEquals("", pages[0].comment) + + +if __name__ == '__main__': + unittest.main()
pywikipedia-svn@lists.wikimedia.org