diff options
Diffstat (limited to 'test/requests/link_checker.py')
-rw-r--r-- | test/requests/link_checker.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/test/requests/link_checker.py b/test/requests/link_checker.py index 12057203..5e16a5cd 100644 --- a/test/requests/link_checker.py +++ b/test/requests/link_checker.py @@ -23,12 +23,9 @@ def is_in_page_link(link): return pattern.match(link) def get_links(doc): - return filter( - lambda x: not ( + return [x for x in [y.get("href") for y in doc.cssselect("a")] if not ( is_root_link(x) - or is_mailto_link(x)) - , map(lambda y: y.get("href") - , doc.cssselect("a"))) + or is_mailto_link(x))] def verify_link(link): if link[0] == "#": @@ -57,9 +54,9 @@ def check_page(host, start_url): print("Checking links host "+host+" in page `"+start_url+"`") doc = parse(start_url).getroot() links = get_links(doc) - in_page_links = filter(is_in_page_link, links) - internal_links = filter(is_internal_link, links) - external_links = filter(lambda x: not (is_internal_link(x) or is_in_page_link(x)), links) + in_page_links = list(filter(is_in_page_link, links)) + internal_links = list(filter(is_internal_link, links)) + external_links = [x for x in links if not (is_internal_link(x) or is_in_page_link(x))] for link in internal_links: verify_link(host+link) |