mirror of https://github.com/astral-sh/uv
Drop some non-integration exclude-newer tests (#17071)
Closes https://github.com/astral-sh/uv/issues/17070 Claude added these and they're unstable and just not useful imo.
This commit is contained in:
parent
94f1f02d85
commit
a550743bed
|
|
@ -640,61 +640,3 @@ impl schemars::JsonSchema for ExcludeNewerValue {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
use std::str::FromStr;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_exclude_newer_timestamp_absolute() {
|
|
||||||
// Test RFC 3339 timestamp
|
|
||||||
let timestamp = ExcludeNewerValue::from_str("2023-01-01T00:00:00Z").unwrap();
|
|
||||||
assert!(timestamp.to_string().contains("2023-01-01"));
|
|
||||||
|
|
||||||
// Test local date
|
|
||||||
let timestamp = ExcludeNewerValue::from_str("2023-06-15").unwrap();
|
|
||||||
assert!(timestamp.to_string().contains("2023-06-16")); // Should be next day
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_exclude_newer_timestamp_relative() {
|
|
||||||
// Test "1 hour" - simpler test case
|
|
||||||
let timestamp = ExcludeNewerValue::from_str("1 hour").unwrap();
|
|
||||||
let now = jiff::Timestamp::now();
|
|
||||||
let diff = now.as_second() - timestamp.timestamp.as_second();
|
|
||||||
// Should be approximately 1 hour (3600 seconds) ago
|
|
||||||
assert!(
|
|
||||||
(3550..=3650).contains(&diff),
|
|
||||||
"Expected ~3600 seconds, got {diff}"
|
|
||||||
);
|
|
||||||
|
|
||||||
// Test that we get a timestamp in the past
|
|
||||||
assert!(timestamp.timestamp < now, "Timestamp should be in the past");
|
|
||||||
|
|
||||||
// Test parsing succeeds for various formats
|
|
||||||
assert!(ExcludeNewerValue::from_str("2 days").is_ok());
|
|
||||||
assert!(ExcludeNewerValue::from_str("1 week").is_ok());
|
|
||||||
assert!(ExcludeNewerValue::from_str("30 days").is_ok());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_exclude_newer_timestamp_invalid() {
|
|
||||||
// Test invalid formats
|
|
||||||
assert!(ExcludeNewerValue::from_str("invalid").is_err());
|
|
||||||
assert!(ExcludeNewerValue::from_str("not a date").is_err());
|
|
||||||
assert!(ExcludeNewerValue::from_str("").is_err());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_exclude_newer_package_entry() {
|
|
||||||
let entry = ExcludeNewerPackageEntry::from_str("numpy=2023-01-01T00:00:00Z").unwrap();
|
|
||||||
assert_eq!(entry.package.as_ref(), "numpy");
|
|
||||||
assert!(entry.timestamp.to_string().contains("2023-01-01"));
|
|
||||||
|
|
||||||
// Test with relative timestamp
|
|
||||||
let entry = ExcludeNewerPackageEntry::from_str("requests=7 days").unwrap();
|
|
||||||
assert_eq!(entry.package.as_ref(), "requests");
|
|
||||||
// Just verify it parsed without error - the timestamp will be relative to now
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue