Exemplo n.º 1
0
def test_get_content(tmpdir):
    testfile = tmpdir.join('test_content.py')
    testfile.write('''
def test_something():
    new_result = '{}'.format('hello')
    assert new_result == 'hello'

class TestSomethingElse():
    def test_se(self):
        pass

def unknown():
    pass
    ''')

    result = list(get_content(filename=Path(str(testfile))))
    assert len(result) == 2
Exemplo n.º 2
0
def test_get_content_for_cls(tmpdir):
    testfile = tmpdir.join('test_content.py')
    testfile.write('''
class TestSomethingElse():
    """
    # Title

    Description
    """
    def test_se(self):
        pass

    ''')
    result = list(get_content(filename=Path(str(testfile))))
    assert len(result) == 1
    section = result[0]
    assert section.title == "Title"
    assert section.name == "SomethingElse"
    assert len(section.examples) == 1
    assert section.examples[0].name == "SomethingElse__se"
def get_desc(link):
    time.sleep(5)
    soup = BeautifulSoup(get_content(link), 'html.parser')
    return soup.find('div', class_='jobsearch-jobDescriptionText').text
Exemplo n.º 4
0
def test_get():
    retorno = get_content()
    assert 200 == retorno