Skip to content

Commit be01fdb

Browse files
committed
Add faster assert to prove file existence
1 parent 6f281f8 commit be01fdb

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/py/tests/test_page_generator.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,25 +126,25 @@ def nonexistent_file_path():
126126
return Path("/nonexistent/path/file.js")
127127

128128

129-
_h_url = st.tuples(
130-
st.sampled_from(["s", ""]),
131-
st.text(
132-
min_size=1,
133-
max_size=20,
134-
alphabet=st.characters(whitelist_categories=("Lu", "Ll")),
135-
),
136-
).map(lambda x: f"http{x[0]}://example.com/{x[1]}.js")
137-
138-
139129
def st_valid_path(dir_path: Path):
140130
file_path = dir_path / "foo.foo"
141131
file_path.touch()
132+
assert file_path.resolve().exists()
142133
_valid_file_string = str(file_path.resolve())
143134

144135
_h_file_str = st.just(_valid_file_string)
145136
_h_file_path = st.just(Path(_valid_file_string))
146137
_h_file_uri = st.just(Path(_valid_file_string).as_uri())
147138

139+
_h_url = st.tuples(
140+
st.sampled_from(["s", ""]),
141+
st.text(
142+
min_size=1,
143+
max_size=20,
144+
alphabet=st.characters(whitelist_categories=("Lu", "Ll")),
145+
),
146+
).map(lambda x: f"http{x[0]}://example.com/{x[1]}.js")
147+
148148
_h_uri = st.one_of(_h_url, _h_file_str, _h_file_path, _h_file_uri)
149149

150150
_h_encoding = st.sampled_from(["utf-8", "utf-16", "ascii", "latin1"])

0 commit comments

Comments
 (0)