예제 #1
0
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]
예제 #2
0
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]
예제 #3
0
    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
예제 #4
0
    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
예제 #5
0
def test_guess_type(name, path, expected):
    """
    Symbol types are correctly guessed.
    """
    assert _guess_type(name, path) == expected
예제 #6
0
def test_guess_type(name, path, expected):
    """
    Symbol types are correctly guessed.
    """
    assert _guess_type(name, path) == expected