mirror of
https://github.com/astral-sh/uv.git
synced 2025-09-19 08:49:46 +00:00
Add fix-up for trailing comma with trailing space (#1409)
## Summary Closes https://github.com/astral-sh/uv/issues/1361. ## Test Plan ```text Resolved 3 packages in 243ms Downloaded 3 packages in 193ms Installed 3 packages in 6ms + et-xmlfile==1.1.0 + jdcal==1.4.1 + openpyxl==3.0.5 ```
This commit is contained in:
parent
0f554b0913
commit
7994b68654
1 changed files with 10 additions and 1 deletions
|
@ -18,7 +18,7 @@ static INVALID_TRAILING_DOT_STAR: Lazy<Regex> =
|
|||
/// Ex) `!=3.0*`
|
||||
static MISSING_DOT: Lazy<Regex> = Lazy::new(|| Regex::new(r"(\d\.\d)+\*").unwrap());
|
||||
/// Ex) `>=3.6,`
|
||||
static TRAILING_COMMA: Lazy<Regex> = Lazy::new(|| Regex::new(r",$").unwrap());
|
||||
static TRAILING_COMMA: Lazy<Regex> = Lazy::new(|| Regex::new(r",\s*$").unwrap());
|
||||
/// Ex) `>= '2.7'`, `>=3.6'`
|
||||
static STRAY_QUOTES: Lazy<Regex> = Lazy::new(|| Regex::new(r#"['"]"#).unwrap());
|
||||
|
||||
|
@ -237,6 +237,15 @@ mod tests {
|
|||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn specifier_trailing_comma_trailing_space() {
|
||||
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/shellingham/?format=application/vnd.pypi.simple.v1+json>
|
||||
#[test]
|
||||
fn specifier_invalid_single_quotes() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue