File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -272,15 +272,21 @@ def test_to_datetime_barely_out_of_bounds():
272272 tslib .array_to_datetime (arr )
273273
274274
275- def test_to_datetime_barely_inside_bounds ():
275+ @pytest .mark .parametrize (
276+ "timestamp" ,
277+ [
278+ # Close enough to bounds that scaling micros to nanos overflows
279+ # but adding nanos would result in an in-bounds datetime.
280+ "1677-09-21T00:12:43.145224193" ,
281+ "1677-09-21T00:12:43.145224999" ,
282+ # this always worked
283+ "1677-09-21T00:12:43.145225000" ,
284+ ],
285+ )
286+ def test_to_datetime_barely_inside_bounds (timestamp ):
276287 # see gh-57150
277- #
278- # Close enough to bounds that scaling micros to nanos overflows
279- # but adding nanos would result in an in-bounds datetime.
280- arr = np .array (["1677-09-21T00:12:43.145224193" ], dtype = object )
281- result , _ = tslib .array_to_datetime (arr )
282- expected = ["1677-09-21T00:12:43.145224193" ]
283- tm .assert_numpy_array_equal (result , np .array (expected , dtype = "M8[ns]" ))
288+ result , _ = tslib .array_to_datetime (np .array ([timestamp ], dtype = object ))
289+ tm .assert_numpy_array_equal (result , np .array ([timestamp ], dtype = "M8[ns]" ))
284290
285291
286292class SubDatetime (datetime ):
You can’t perform that action at this time.
0 commit comments