diff --git a/src/round.rs b/src/round.rs index ef3e39d2ba..f30422e3e9 100644 --- a/src/round.rs +++ b/src/round.rs @@ -517,7 +517,7 @@ mod tests { "2020-10-28 00:00:00 +01:00" ); assert_eq!( - dt.duration_round(TimeDelta::weeks(1)).unwrap().to_string(), + dt.duration_round(TimeDelta::try_weeks(1).unwrap()).unwrap().to_string(), "2020-10-29 00:00:00 +01:00" ); @@ -529,7 +529,7 @@ mod tests { "2020-10-28 00:00:00 -01:00" ); assert_eq!( - dt.duration_round(TimeDelta::weeks(1)).unwrap().to_string(), + dt.duration_round(TimeDelta::try_weeks(1).unwrap()).unwrap().to_string(), "2020-10-29 00:00:00 -01:00" ); } @@ -679,7 +679,7 @@ mod tests { "2020-10-27 00:00:00 +01:00" ); assert_eq!( - dt.duration_trunc(TimeDelta::weeks(1)).unwrap().to_string(), + dt.duration_trunc(TimeDelta::try_weeks(1).unwrap()).unwrap().to_string(), "2020-10-22 00:00:00 +01:00" ); @@ -691,7 +691,7 @@ mod tests { "2020-10-27 00:00:00 -01:00" ); assert_eq!( - dt.duration_trunc(TimeDelta::weeks(1)).unwrap().to_string(), + dt.duration_trunc(TimeDelta::try_weeks(1).unwrap()).unwrap().to_string(), "2020-10-22 00:00:00 -01:00" ); } diff --git a/src/time_delta.rs b/src/time_delta.rs index f9bdffa58e..9f5b7b6a65 100644 --- a/src/time_delta.rs +++ b/src/time_delta.rs @@ -616,6 +616,7 @@ impl arbitrary::Arbitrary<'_> for TimeDelta { mod tests { use super::OutOfRangeError; use super::{TimeDelta, MAX, MIN}; + use crate::expect; use core::time::Duration; #[test] @@ -1188,7 +1189,7 @@ mod tests { #[test] fn test_duration_const() { - const ONE_WEEK: TimeDelta = TimeDelta::weeks(1); + const ONE_WEEK: TimeDelta = expect!(TimeDelta::try_weeks(1), ""); const ONE_DAY: TimeDelta = TimeDelta::days(1); const ONE_HOUR: TimeDelta = TimeDelta::hours(1); const ONE_MINUTE: TimeDelta = TimeDelta::minutes(1);