Skip to content

Commit 776617d

Browse files
authored
Merge pull request #6424 from LMFDB/autopep8-patches
2 parents d39d0d3 + 042d54b commit 776617d

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

lmfdb/tests/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ def check_external(self, homepage, path, text):
8585
https_handler = HTTPSHandler(context=context)
8686
opener = build_opener(redirect_handler, http_handler, https_handler)
8787
response = opener.open(request)
88-
88+
8989
# Check if we were redirected
9090
final_url = response.geturl()
9191
if final_url != path:
9292
print(f"Redirected from {path} to {final_url}")
93-
93+
9494
response_text = response.read().decode("utf-8")
95-
95+
9696
assert text in response_text, f"Text '{text}' not found in response from {path} (final URL: {final_url})"
9797
except URLError as e:
9898
if e.errno in [errno.ETIMEDOUT, errno.ECONNREFUSED, errno.EHOSTDOWN]:

lmfdb/tests/test_homepage.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ def _get_links_data(cls):
2020
if cls._links_data is None:
2121
lmfdb_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
2222
yaml_path = os.path.join(lmfdb_dir, "homepage", "index_boxes.yaml")
23-
23+
2424
with open(yaml_path, "r") as f:
2525
boxes = list(yaml.load_all(f, Loader=yaml.FullLoader))
26-
26+
2727
links = []
2828
for box_idx, box in enumerate(boxes):
2929
box_title = box.get("title", f"Box {box_idx + 1}")
30-
30+
3131
if "content" in box:
3232
urls = cls._parse_links_from_content(box["content"])
3333
for url in urls:
@@ -37,7 +37,7 @@ def _get_links_data(cls):
3737
"is_external": url.startswith(('http://', 'https://')),
3838
"is_internal": url.startswith('/'),
3939
})
40-
40+
4141
cls._links_data = links
4242
return cls._links_data
4343

@@ -52,9 +52,9 @@ def _test_link(self, link_info):
5252
url = link_info["url"]
5353
box_title = link_info["box_title"]
5454
homepage = self._get_homepage()
55-
55+
5656
# Check that link appears in homepage
57-
self.assertIn(url, homepage,
57+
self.assertIn(url, homepage,
5858
f"Link {url} from {box_title} not found in homepage")
5959

6060
if link_info["is_external"]:
@@ -73,7 +73,7 @@ def test_all_internal_links(self):
7373
"""Test all internal links found in index_boxes.yaml."""
7474
links = self._get_links_data()
7575
internal_links = [link for link in links if link["is_internal"]]
76-
76+
7777
for link_info in internal_links:
7878
with self.subTest(url=link_info["url"], box=link_info["box_title"]):
7979
self._test_link(link_info)
@@ -82,23 +82,23 @@ def test_all_external_links(self):
8282
"""Test all external links found in index_boxes.yaml."""
8383
links = self._get_links_data()
8484
external_links = [link for link in links if link["is_external"]]
85-
85+
8686
for link_info in external_links:
8787
with self.subTest(url=link_info["url"], box=link_info["box_title"]):
8888
self._test_link(link_info)
8989

9090
def test_all_links_by_box(self):
9191
"""Test all links grouped by box."""
9292
links = self._get_links_data()
93-
93+
9494
# Group links by box
9595
boxes = {}
9696
for link in links:
9797
box_title = link["box_title"]
9898
if box_title not in boxes:
9999
boxes[box_title] = []
100100
boxes[box_title].append(link)
101-
101+
102102
for box_title, box_links in boxes.items():
103103
with self.subTest(box=box_title):
104104
for link_info in box_links:
@@ -118,23 +118,23 @@ def test_method(self):
118118
for link_info in box_links:
119119
with self.subTest(url=link_info["url"]):
120120
self._test_link(link_info)
121-
121+
122122
test_method.__doc__ = f"Test links from box: {box_title}"
123123
return test_method
124124

125125

126126
# Add individual box tests
127127
try:
128128
links = HomePageTest._get_links_data()
129-
129+
130130
# Group links by box for dynamic test creation
131131
boxes = {}
132132
for link in links:
133133
box_title = link["box_title"]
134134
if box_title not in boxes:
135135
boxes[box_title] = []
136136
boxes[box_title].append(link)
137-
137+
138138
# Create test methods for each box
139139
for box_title, box_links in boxes.items():
140140
safe_name = re.sub(r'[^a-zA-Z0-9_]', '_', box_title.lower())

0 commit comments

Comments
 (0)