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:
konsti 2024-01-04 14:45:41 +01:00 committed by GitHub
parent 0c5ca1cdd8
commit 7d6e6fae25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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"(\d\.(\d|\*))+,$").unwrap());
static TRAILING_COMMA: Lazy<Regex> = Lazy::new(|| Regex::new(r",$").unwrap());
/// Ex) `>= '2.7'`, `>=3.6'`
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();
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);
}
}