diff --git a/crates/uv-client/src/html.rs b/crates/uv-client/src/html.rs index 0dc9c07b9..3c5bbd73b 100644 --- a/crates/uv-client/src/html.rs +++ b/crates/uv-client/src/html.rs @@ -909,4 +909,403 @@ mod tests { } "###); } + + + #[test] + fn parse_devpi_listing() { + let text = r##" + + + + + packages/all/: puffling versions + + + + + + + + + + +
+ + + + + +
+ +
+

packages/all/: puffling versions

+ +

+ Simple index +

+ +

+

+

+ + + + + + + + + + + + + + + + + + + +
IndexVersionDocumentation
packages/pypi0.1.1
packages/pypi0.1.0
+
+ + + + + + + "##; + let base = Url::parse("https://download.pytorch.org/whl/jinja2/").unwrap(); + let result = SimpleHtml::parse(text, &base).unwrap(); + insta::assert_debug_snapshot!(result, @r###" + SimpleHtml { + base: BaseUrl( + Url { + scheme: "https", + cannot_be_a_base: false, + username: "", + password: None, + host: Some( + Domain( + "download.pytorch.org", + ), + ), + port: None, + path: "/whl/jinja2/", + query: None, + fragment: None, + }, + ), + files: [ + File { + dist_info_metadata: None, + filename: "", + hashes: Hashes { + md5: None, + sha256: None, + }, + requires_python: None, + size: None, + upload_time: None, + url: "http://localhost:3141/", + yanked: None, + }, + File { + dist_info_metadata: None, + filename: "", + hashes: Hashes { + md5: None, + sha256: None, + }, + requires_python: None, + size: None, + upload_time: None, + url: "#", + yanked: None, + }, + File { + dist_info_metadata: None, + filename: "", + hashes: Hashes { + md5: None, + sha256: None, + }, + requires_python: None, + size: None, + upload_time: None, + url: "http://localhost:3141/", + yanked: None, + }, + File { + dist_info_metadata: None, + filename: "+searchhelp", + hashes: Hashes { + md5: None, + sha256: None, + }, + requires_python: None, + size: None, + upload_time: None, + url: "http://localhost:3141/+searchhelp", + yanked: None, + }, + File { + dist_info_metadata: None, + filename: "+status", + hashes: Hashes { + md5: None, + sha256: None, + }, + requires_python: None, + size: None, + upload_time: None, + url: "http://localhost:3141/+status", + yanked: None, + }, + File { + dist_info_metadata: None, + filename: "0.1.0", + hashes: Hashes { + md5: None, + sha256: None, + }, + requires_python: None, + size: None, + upload_time: None, + url: "http://localhost:3141/packages/pypi/puffling/0.1.0", + yanked: None, + }, + File { + dist_info_metadata: None, + filename: "0.1.1", + hashes: Hashes { + md5: None, + sha256: None, + }, + requires_python: None, + size: None, + upload_time: None, + url: "http://localhost:3141/packages/pypi/puffling/0.1.1", + yanked: None, + }, + File { + dist_info_metadata: None, + filename: "all", + hashes: Hashes { + md5: None, + sha256: None, + }, + requires_python: None, + size: None, + upload_time: None, + url: "http://localhost:3141/packages/all", + yanked: None, + }, + File { + dist_info_metadata: None, + filename: "packages", + hashes: Hashes { + md5: None, + sha256: None, + }, + requires_python: None, + size: None, + upload_time: None, + url: "http://localhost:3141/packages", + yanked: None, + }, + File { + dist_info_metadata: None, + filename: "puffling", + hashes: Hashes { + md5: None, + sha256: None, + }, + requires_python: None, + size: None, + upload_time: None, + url: "http://localhost:3141/packages/all/puffling", + yanked: None, + }, + File { + dist_info_metadata: None, + filename: "puffling", + hashes: Hashes { + md5: None, + sha256: None, + }, + requires_python: None, + size: None, + upload_time: None, + url: "http://localhost:3141/packages/all/+simple/puffling", + yanked: None, + }, + File { + dist_info_metadata: None, + filename: "pypi", + hashes: Hashes { + md5: None, + sha256: None, + }, + requires_python: None, + size: None, + upload_time: None, + url: "http://localhost:3141/packages/pypi", + yanked: None, + }, + File { + dist_info_metadata: None, + filename: "pypi", + hashes: Hashes { + md5: None, + sha256: None, + }, + requires_python: None, + size: None, + upload_time: None, + url: "http://localhost:3141/packages/pypi", + yanked: None, + }, + File { + dist_info_metadata: None, + filename: "pypi?:action=list_classifiers", + hashes: Hashes { + md5: None, + sha256: None, + }, + requires_python: None, + size: None, + upload_time: None, + url: "https://pypi.org/pypi?%3Aaction=list_classifiers", + yanked: None, + }, + ], + } + "###); + } }