mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
pep508: fix doc test
This doc test seems to fail due to the recent change making `Requirement` generic on its URL type. While the type parameter was given a default of `VerbatimUrl`, this default doesn't always apply. For example, the `FromStr` impl on `Requirement` is still generic on any URL type, and so callers must indicate the type of the URL to return. (An alternative would be to define the `FromStr` impl for just the default URL type.)
This commit is contained in:
parent
3d7a0a2ba1
commit
624f92b3f8
1 changed files with 2 additions and 2 deletions
|
@ -5,11 +5,11 @@
|
|||
//!
|
||||
//! ```
|
||||
//! use std::str::FromStr;
|
||||
//! use pep508_rs::Requirement;
|
||||
//! use pep508_rs::{Requirement, VerbatimUrl};
|
||||
//! use uv_normalize::ExtraName;
|
||||
//!
|
||||
//! let marker = r#"requests [security,tests] >= 2.8.1, == 2.8.* ; python_version > "3.8""#;
|
||||
//! let dependency_specification = Requirement::from_str(marker).unwrap();
|
||||
//! let dependency_specification = Requirement::<VerbatimUrl>::from_str(marker).unwrap();
|
||||
//! assert_eq!(dependency_specification.name.as_ref(), "requests");
|
||||
//! assert_eq!(dependency_specification.extras, vec![ExtraName::from_str("security").unwrap(), ExtraName::from_str("tests").unwrap()]);
|
||||
//! ```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue