aboutsummaryrefslogtreecommitdiff
path: root/test/requests
diff options
context:
space:
mode:
authorBonfaceKilz2020-08-19 02:38:15 +0300
committerBonfaceKilz2020-08-19 02:38:15 +0300
commit28e75b1c96819eab1e8052a3045ece26e5f35c42 (patch)
tree0817432d9b062319163c86e5c2a957e64aa62593 /test/requests
parentba123e1e0fe693f9778993c3f8e5a70a28658a4c (diff)
downloadgenenetwork2-28e75b1c96819eab1e8052a3045ece26e5f35c42.tar.gz
Wrap `filter()` usage in a `list` call
Run `2to3-3.8 -f filter -w .` See <https://docs.python.org/2/library/2to3.html#2to3fixer-filter>
Diffstat (limited to 'test/requests')
-rw-r--r--test/requests/link_checker.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/test/requests/link_checker.py b/test/requests/link_checker.py
index df4d32d8..fa70747d 100644
--- a/test/requests/link_checker.py
+++ b/test/requests/link_checker.py
@@ -23,11 +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))
- , [y.get("href") for y in doc.cssselect("a")])
+ or is_mailto_link(x))]
def verify_link(link):
if link[0] == "#":
@@ -56,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)