Revision: 6765 Author: nicdumz Date: 2009-04-30 08:46:35 +0000 (Thu, 30 Apr 2009)
Log Message: ----------- [ 2782305 ] xmlreader.xmldump allrevision missing title Applying patch by Johan Euphrosine, and adding a few more assertions testing xmlreader
Modified Paths: -------------- trunk/pywikipedia/tests/test-xmlreader.py trunk/pywikipedia/xmlreader.py
Modified: trunk/pywikipedia/tests/test-xmlreader.py =================================================================== --- trunk/pywikipedia/tests/test-xmlreader.py 2009-04-30 08:28:31 UTC (rev 6764) +++ trunk/pywikipedia/tests/test-xmlreader.py 2009-04-30 08:46:35 UTC (rev 6765) @@ -11,12 +11,19 @@ def test_XmlDumpAllRevs(self): pages = [r for r in xmlreader.XmlDump("data/article-pear.xml", allrevisions=True).parse()] self.assertEquals(4, len(pages)) - self.assertNotEquals("", pages[0].comment) + 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.assertNotEquals("", pages[0].comment) + 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()
Modified: trunk/pywikipedia/xmlreader.py =================================================================== --- trunk/pywikipedia/xmlreader.py 2009-04-30 08:28:31 UTC (rev 6764) +++ trunk/pywikipedia/xmlreader.py 2009-04-30 08:46:35 UTC (rev 6765) @@ -304,7 +304,7 @@
def _parse_all(self, event, elem): """Parser that yields all revisions""" - if event == "start" and elem.tag == "{%s}revision" % self.uri: + if event == "start" and elem.tag == "{%s}page" % self.uri: self._headers(elem)
if event == "end" and elem.tag == "{%s}revision" % self.uri: