def test_guess_type(): ts = [ ('startServer', 'twisted.conch.test.test_cftp.CFTPClientTestBase.html#startServer', types.METHOD), ('A', 'twisted.test.myrebuilder1.A.html', types.CLASS), ('epollreactor', 'twisted.internet.epollreactor.html', types.PACKAGE) ] for t in ts: assert _guess_type(t[0], t[1]) == t[2]
def parse(self): """Parse pydoctor docs at *docpath*. yield tuples of symbol name, type and path """ soup = BeautifulSoup( open(os.path.join(self.docpath, 'nameIndex.html')), 'lxml') log.info('Creating database...') for tag in soup.body.find_all('a'): path = tag.get('href') if path and not path.startswith('#'): name = tag.string yield name, _guess_type(name, path), path
def parse(self): """Parse pydoctor docs at *docpath*. yield tuples of symbol name, type and path """ soup = BeautifulSoup( open(os.path.join(self.docpath, 'nameIndex.html')), 'lxml' ) log.info('Creating database...') for tag in soup.body.find_all('a'): path = tag.get('href') if path and not path.startswith('#'): name = tag.string yield name, _guess_type(name, path), path
def test_guess_type(name, path, expected): """ Symbol types are correctly guessed. """ assert _guess_type(name, path) == expected