mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 10:58:28 +00:00
Fix pep508_rs
doc test (#963)
Since nextest does not run doctests, this did not show up on CI.
This commit is contained in:
parent
5ec5a3243c
commit
7acde5a9a0
2 changed files with 7 additions and 6 deletions
|
@ -733,15 +733,16 @@ impl MarkerExpression {
|
|||
/// # use pep440_rs::Version;
|
||||
///
|
||||
/// # fn main() -> Result<(), Pep508Error> {
|
||||
/// use puffin_normalize::ExtraName;
|
||||
/// let marker_tree = MarkerTree::from_str(r#"("linux" in sys_platform) and extra == 'day'"#)?;
|
||||
/// let versions: Vec<Version> = (8..12).map(|minor| Version::new([3, minor])).collect();
|
||||
/// assert!(marker_tree.evaluate_extras_and_python_version(&["day".to_string()].into(), &versions));
|
||||
/// assert!(!marker_tree.evaluate_extras_and_python_version(&["night".to_string()].into(), &versions));
|
||||
/// assert!(marker_tree.evaluate_extras_and_python_version(&[ExtraName::from_str("day").unwrap()].into(), &versions));
|
||||
/// assert!(!marker_tree.evaluate_extras_and_python_version(&[ExtraName::from_str("night").unwrap()].into(), &versions));
|
||||
///
|
||||
/// let marker_tree = MarkerTree::from_str(r#"extra == 'day' and python_version < '3.11' and '3.10' <= python_version"#)?;
|
||||
/// assert!(!marker_tree.evaluate_extras_and_python_version(&["day".to_string()].into(), &vec![Version::new([3, 9])]));
|
||||
/// assert!(marker_tree.evaluate_extras_and_python_version(&["day".to_string()].into(), &vec![Version::new([3, 10])]));
|
||||
/// assert!(!marker_tree.evaluate_extras_and_python_version(&["day".to_string()].into(), &vec![Version::new([3, 11])]));
|
||||
/// assert!(!marker_tree.evaluate_extras_and_python_version(&[ExtraName::from_str("day").unwrap()].into(), &vec![Version::new([3, 9])]));
|
||||
/// assert!(marker_tree.evaluate_extras_and_python_version(&[ExtraName::from_str("day").unwrap()].into(), &vec![Version::new([3, 10])]));
|
||||
/// assert!(!marker_tree.evaluate_extras_and_python_version(&[ExtraName::from_str("day").unwrap()].into(), &vec![Version::new([3, 11])]));
|
||||
/// # Ok(())
|
||||
/// # }
|
||||
/// ```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue