Skip to content

Commit f08c93b

Browse files
authored
Update test for static files (#47)
1 parent c32e3d1 commit f08c93b

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎tests/test_options.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,13 @@ def test_static_files(app, favicon_tags, favicon_tags_for_nested):
114114
favicon_tags: Favicon tags in index.html page.
115115
favicon_tags_for_nested: Favicon tags in nested/page.html page.
116116
"""
117-
# this test should have 2 favicons
117+
expected_urls = [
118+
"_static/square.svg",
119+
"_static/nested/triangle.svg",
120+
"_static/circle.svg",
121+
]
122+
123+
# this test should have 3 favicons
118124
assert len(favicon_tags) == 3
119125

120126
# all favicons should have rel, href, and type attributes
@@ -124,11 +130,13 @@ def test_static_files(app, favicon_tags, favicon_tags_for_nested):
124130
assert favicon_tag["type"] == "image/svg+xml"
125131
assert "static-file" not in favicon_tag
126132

133+
# check favicons in top level page (should be "_static/square.svg", etc.)
127134
for favicon_tag in favicon_tags:
128-
assert favicon_tag["href"].startswith("_static")
135+
assert favicon_tag["href"] in expected_urls
129136

137+
# check favicon URLS for pages in subfolders (should be "../_static/square.svg", etc.)
130138
for favicon_tag in favicon_tags_for_nested:
131-
assert favicon_tag["href"].startswith("../_static")
139+
assert favicon_tag["href"] in [f"../{url}" for url in expected_urls]
132140

133141
static = Path(app.outdir, "_static")
134142
assert (static / "square.svg").exists()

0 commit comments

Comments
 (0)