def test__string_dump__number_of_pages(self): titles = ['Ross_Ice_Shelf', 'Southern_Cross_Expedition', 'Ice_shelf'] output = StringIO.StringIO() webtools.make_articles_dump(titles, output) content = output.getvalue() output.close() self.assertEqual(content.count('<page>'), len(titles))
def test__string_dump__valid_xml(self): titles = ['Ross_Ice_Shelf', 'Southern_Cross_Expedition', 'Ice_shelf'] output = StringIO.StringIO() webtools.make_articles_dump(titles, output) content = output.getvalue() output.close() root = etree.fromstring(content) pages = root.findall(parse_tools.PAGE_TAG) self.assertEqual(len(pages), len(titles))