Add more test cases

This commit is contained in:
konstin 2025-06-30 11:09:20 +02:00
parent d4664db072
commit 61bc7f4a68
2 changed files with 41 additions and 2 deletions

View file

@ -3398,7 +3398,7 @@ mod test {
/// Case a: There is no version `3` (no trailing zero) in the interner yet.
#[test]
fn maker_normalization_a() {
fn marker_normalization_a() {
let left_tree = m("python_version == '3.0.*'");
let left = left_tree.try_to_string().unwrap();
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.
#[test]
fn maker_normalization_b() {
fn marker_normalization_b() {
m("python_version >= '3' and 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.*'";
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}");
}
}

View file

@ -28725,3 +28725,34 @@ fn lock_prefix_match() -> Result<()> {
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(())
}