Quote version parse errors consistently (#3325)

This commit is contained in:
Zanie Blue 2024-04-30 12:20:14 -05:00 committed by GitHub
parent d57af514d9
commit 100dbe475c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 8 deletions

View file

@ -2141,7 +2141,7 @@ impl std::fmt::Display for VersionParseError {
} => {
write!(
f,
"after parsing {version}, found {remaining:?} after it, \
"after parsing '{version}', found '{remaining}', \
which is not part of a valid version",
)
}

View file

@ -1997,10 +1997,11 @@ mod tests {
fn error_invalid_prerelease() {
assert_snapshot!(
parse_pepe508_err("name==1.0.org1"),
@"
after parsing 1.0, found \".org1\" after it, which is not part of a valid version
name==1.0.org1
^^^^^^^^^^"
@r###"
after parsing '1.0', found '.org1', which is not part of a valid version
name==1.0.org1
^^^^^^^^^^
"###
);
}

View file

@ -984,7 +984,7 @@ fn compile_python_invalid_version() -> Result<()> {
----- stdout -----
----- stderr -----
error: invalid value '3.7.x' for '--python-version <PYTHON_VERSION>': after parsing 3.7, found ".x" after it, which is not part of a valid version
error: invalid value '3.7.x' for '--python-version <PYTHON_VERSION>': after parsing '3.7', found '.x', which is not part of a valid version
For more information, try '--help'.
"###

View file

@ -92,7 +92,7 @@ fn invalid_requirement() -> Result<()> {
----- stderr -----
error: Failed to parse `flask==1.0.x`
Caused by: after parsing 1.0, found ".x" after it, which is not part of a valid version
Caused by: after parsing '1.0', found '.x', which is not part of a valid version
flask==1.0.x
^^^^^^^
"###);
@ -141,7 +141,7 @@ fn invalid_requirements_txt_requirement() -> Result<()> {
----- stderr -----
error: Couldn't parse requirement in `requirements.txt` at position 0
Caused by: after parsing 1.0, found ".x" after it, which is not part of a valid version
Caused by: after parsing '1.0', found '.x', which is not part of a valid version
flask==1.0.x
^^^^^^^
"###);