Skip to content

Commit 2491165

Browse files
Adjust for deprecated functions
1 parent a66a002 commit 2491165

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

crates/readstat-tests/tests/parse_all_types_test.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,10 @@ fn parse_all_types_datetime() {
197197

198198
// non-missing value
199199
let dt = timestamp_s_to_datetime(col.value(1));
200-
let dt_literal = NaiveDate::from_ymd(2021, 6, 1).and_hms_milli(13, 42, 25, 0);
200+
let dt_literal = NaiveDate::from_ymd_opt(2021, 6, 1)
201+
.unwrap()
202+
.and_hms_milli_opt(13, 42, 25, 0)
203+
.unwrap();
201204

202205
assert_eq!(dt, dt_literal);
203206
}

crates/readstat-tests/tests/row_offset_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ fn row_offset_date() {
186186
.to(DataType::Date32);
187187

188188
let date = date32_to_date(col.value(0));
189-
let date_literal = NaiveDate::from_ymd(2014, 5, 22);
189+
let date_literal = NaiveDate::from_ymd_opt(2014, 5, 22).unwrap();
190190

191191
assert_eq!(date, date_literal);
192192
}

crates/readstat-tests/tests/skip_row_count_test.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,10 @@ fn skip_row_count_datetime() {
216216

217217
// non-missing value
218218
let dt = timestamp_s_to_datetime(col.value(1));
219-
let dt_literal = NaiveDate::from_ymd(2021, 6, 1).and_hms_milli(13, 42, 25, 0);
219+
let dt_literal = NaiveDate::from_ymd_opt(2021, 6, 1)
220+
.unwrap()
221+
.and_hms_milli_opt(13, 42, 25, 0)
222+
.unwrap();
220223

221224
assert_eq!(dt, dt_literal);
222225
}

0 commit comments

Comments
 (0)