mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 10:58:28 +00:00
Add more test cases
This commit is contained in:
parent
d4664db072
commit
61bc7f4a68
2 changed files with 41 additions and 2 deletions
|
@ -3398,7 +3398,7 @@ mod test {
|
||||||
|
|
||||||
/// Case a: There is no version `3` (no trailing zero) in the interner yet.
|
/// Case a: There is no version `3` (no trailing zero) in the interner yet.
|
||||||
#[test]
|
#[test]
|
||||||
fn maker_normalization_a() {
|
fn marker_normalization_a() {
|
||||||
let left_tree = m("python_version == '3.0.*'");
|
let left_tree = m("python_version == '3.0.*'");
|
||||||
let left = left_tree.try_to_string().unwrap();
|
let left = left_tree.try_to_string().unwrap();
|
||||||
let right = "python_full_version == '3.0.*'";
|
let right = "python_full_version == '3.0.*'";
|
||||||
|
@ -3407,7 +3407,7 @@ mod test {
|
||||||
|
|
||||||
/// Case b: There is already a version `3` (no trailing zero) in the interner.
|
/// Case b: There is already a version `3` (no trailing zero) in the interner.
|
||||||
#[test]
|
#[test]
|
||||||
fn maker_normalization_b() {
|
fn marker_normalization_b() {
|
||||||
m("python_version >= '3' and python_version <= '3.0'");
|
m("python_version >= '3' and python_version <= '3.0'");
|
||||||
|
|
||||||
let left_tree = m("python_version == '3.0.*'");
|
let left_tree = m("python_version == '3.0.*'");
|
||||||
|
@ -3415,4 +3415,12 @@ mod test {
|
||||||
let right = "python_full_version == '3.0.*'";
|
let right = "python_full_version == '3.0.*'";
|
||||||
assert_eq!(left, right, "{left} != {right}");
|
assert_eq!(left, right, "{left} != {right}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn marker_normalization_c() {
|
||||||
|
let left_tree = MarkerTree::from_str("python_version == '3.10.0.*'").unwrap();
|
||||||
|
let left = left_tree.try_to_string().unwrap();
|
||||||
|
let right = "python_full_version == '3.10.*'";
|
||||||
|
assert_eq!(left, right, "{left} != {right}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28725,3 +28725,34 @@ fn lock_prefix_match() -> Result<()> {
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Regression test for https://github.com/astral-sh/uv/issues/14231.
|
||||||
|
#[test]
|
||||||
|
fn test_tilde_equals_python_version() -> Result<()> {
|
||||||
|
let context = TestContext::new("3.12");
|
||||||
|
|
||||||
|
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||||
|
pyproject_toml.write_str(
|
||||||
|
r#"
|
||||||
|
[project]
|
||||||
|
name = "debug"
|
||||||
|
version = "0.1.0"
|
||||||
|
requires-python = ">=3.9"
|
||||||
|
dependencies = [
|
||||||
|
"anyio==4.2.0; python_full_version >= '3.11'",
|
||||||
|
"anyio==4.3.0; python_full_version ~= '3.10.0'",
|
||||||
|
]
|
||||||
|
"#,
|
||||||
|
)?;
|
||||||
|
|
||||||
|
uv_snapshot!(context.filters(), context.lock(), @r"
|
||||||
|
success: true
|
||||||
|
exit_code: 0
|
||||||
|
----- stdout -----
|
||||||
|
|
||||||
|
----- stderr -----
|
||||||
|
Resolved 7 packages in [TIME]
|
||||||
|
");
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue