def _test_one_link(self, content, url): self.count_url = 0 h = linkparse.LinkFinder(self._test_one_url(url), linkparse.LinkTags) try: htmlsax.process_soup(h, htmlsax.make_soup(content)) except linkparse.StopParse: pass self.assertEqual(self.count_url, 1)
def _test_no_link(self, content): def callback(url, line, column, name, base): self.assertTrue(False, 'URL %r found' % url) h = linkparse.LinkFinder(callback, linkparse.LinkTags) try: htmlsax.process_soup(h, htmlsax.make_soup(content)) except linkparse.StopParse: pass
def _test_one_link (self, content, url): self.count_url = 0 h = linkparse.LinkFinder(self._test_one_url(url)) p = linkcheck.HtmlParser.htmlsax.parser(h) h.parser = p try: p.feed(content) p.flush() except linkparse.StopParse: pass h.parser = None p.handler = None
def _test_no_link (self, content): def callback (url, line, column, name, base): self.assertTrue(False, 'URL %r found' % url) h = linkparse.LinkFinder(callback) p = linkcheck.HtmlParser.htmlsax.parser(h) h.parser = p try: p.feed(content) p.flush() except linkparse.StopParse: pass h.parser = None p.handler = None