def test_links(): res = lt.send_request(domain) r = lt.links(res) wikis = lt.links(res, search='wiki') assert isinstance(r, list) assert '#' not in r and '' not in r assert len(set(r)) == len(r) assert all(['wiki' in wiki for wiki in wikis])
def test_links(): res = requests.get(lt.ensure_schema(f'{domain}/post')) r = lt.links(res) search_imgs = lt.links(res, search='image') re_imgs = lt.links(res, pattern='.*/image/.*') assert isinstance(r, list) assert '#' not in r and '' not in r assert len(set(r)) == len(r) assert all(['image' in img for img in search_imgs]) assert all(['image' in img for img in re_imgs])
def get_tasklist(url): res = lt.send_request(url) categories = lt.links(res, search='/cp') tasklist = [ f'{domain}/pg{n}-{c[1:]}' for c in categories for n in range(1, 101) ] return tasklist
def test_links(): res = lt.send_request(domain) r = lt.links(res) assert type(r) == list and '#' not in r
def test_absolute_links(): res = lt.send_request('http://www.spbeen.com') hrefs = [href.replace('http://','') for href in lt.links(res, absolute=True)] assert len([href for href in hrefs if "//" in href])==0