mirror of
https://github.com/astral-sh/uv.git
synced 2025-09-27 04:29:10 +00:00
Requirement fixup for trailing comma after trailing quote (#776)
Fixup for
7349527cea/boto3-1.2.0-py2.py3-none-any.whl
:
```
botocore>=1.3.0,<1.4.0',
```
Note that neither the quote nor the comma are right.
This commit is contained in:
parent
0c5ca1cdd8
commit
7d6e6fae25
1 changed files with 11 additions and 1 deletions
|
@ -18,7 +18,7 @@ static INVALID_TRAILING_DOT_STAR: Lazy<Regex> =
|
||||||
/// Ex) `!=3.0*`
|
/// Ex) `!=3.0*`
|
||||||
static MISSING_DOT: Lazy<Regex> = Lazy::new(|| Regex::new(r"(\d\.\d)+\*").unwrap());
|
static MISSING_DOT: Lazy<Regex> = Lazy::new(|| Regex::new(r"(\d\.\d)+\*").unwrap());
|
||||||
/// Ex) `>=3.6,`
|
/// Ex) `>=3.6,`
|
||||||
static TRAILING_COMMA: Lazy<Regex> = Lazy::new(|| Regex::new(r"(\d\.(\d|\*))+,$").unwrap());
|
static TRAILING_COMMA: Lazy<Regex> = Lazy::new(|| Regex::new(r",$").unwrap());
|
||||||
/// Ex) `>= '2.7'`, `>=3.6'`
|
/// Ex) `>= '2.7'`, `>=3.6'`
|
||||||
static STRAY_QUOTES: Lazy<Regex> = Lazy::new(|| Regex::new(r#"['"]"#).unwrap());
|
static STRAY_QUOTES: Lazy<Regex> = Lazy::new(|| Regex::new(r#"['"]"#).unwrap());
|
||||||
|
|
||||||
|
@ -299,4 +299,14 @@ mod tests {
|
||||||
let expected: VersionSpecifiers = VersionSpecifiers::from_str(">=3.6").unwrap();
|
let expected: VersionSpecifiers = VersionSpecifiers::from_str(">=3.6").unwrap();
|
||||||
assert_eq!(actual, expected);
|
assert_eq!(actual, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <https://files.pythonhosted.org/packages/74/49/7349527cea7f708e7d3253ab6b32c9b5bdf84a57dde8fc265a33e6a4e662/boto3-1.2.0-py2.py3-none-any.whl>
|
||||||
|
#[test]
|
||||||
|
fn trailing_comma_after_quote() {
|
||||||
|
let actual: Requirement = LenientRequirement::from_str("botocore>=1.3.0,<1.4.0',")
|
||||||
|
.unwrap()
|
||||||
|
.into();
|
||||||
|
let expected: Requirement = Requirement::from_str("botocore>=1.3.0,<1.4.0").unwrap();
|
||||||
|
assert_eq!(actual, expected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue