mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-24 05:35:04 +00:00
Add fixup for invalid double quotes (#663)
Closes https://github.com/astral-sh/puffin/issues/658.
This commit is contained in:
parent
9470c20e7a
commit
47290f784e
1 changed files with 12 additions and 2 deletions
|
@ -20,7 +20,7 @@ static MISSING_DOT: Lazy<Regex> = Lazy::new(|| Regex::new(r"(\d\.\d)+\*").unwrap
|
|||
static TRAILING_COMMA: Lazy<Regex> = Lazy::new(|| Regex::new(r"(\d\.(\d|\*))+,$").unwrap());
|
||||
/// Ex) `>= '2.7'`
|
||||
static INVALID_QUOTES: Lazy<Regex> =
|
||||
Lazy::new(|| Regex::new(r"((?:~=|==|!=|<=|>=|<|>|===) )*'(\d(?:\.\d)*)'").unwrap());
|
||||
Lazy::new(|| Regex::new(r#"((?:~=|==|!=|<=|>=|<|>|===) )*['"](\d(?:\.\d)*)['"]"#).unwrap());
|
||||
|
||||
/// Regex to match the invalid specifier, replacement to fix it and message about was wrong and
|
||||
/// fixed
|
||||
|
@ -239,7 +239,7 @@ mod tests {
|
|||
|
||||
/// <https://pypi.org/simple/shellingham/?format=application/vnd.pypi.simple.v1+json>
|
||||
#[test]
|
||||
fn specifier_invalid_quotes() {
|
||||
fn specifier_invalid_single_quotes() {
|
||||
let actual: VersionSpecifiers = LenientVersionSpecifiers::from_str(">= '2.7'")
|
||||
.unwrap()
|
||||
.into();
|
||||
|
@ -247,6 +247,16 @@ mod tests {
|
|||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
/// <https://pypi.org/simple/tensorflowonspark/?format=application/vnd.pypi.simple.v1+json>
|
||||
#[test]
|
||||
fn specifier_invalid_double_quotes() {
|
||||
let actual: VersionSpecifiers = LenientVersionSpecifiers::from_str(">=\"3.6\"")
|
||||
.unwrap()
|
||||
.into();
|
||||
let expected: VersionSpecifiers = VersionSpecifiers::from_str(">=3.6").unwrap();
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
/// <https://pypi.org/simple/celery/?format=application/vnd.pypi.simple.v1+json>
|
||||
#[test]
|
||||
fn specifier_multi_fix() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue