@@ -1031,23 +1031,28 @@ def test_dti_constructor_with_non_nano_dtype(self, tz):
1031
1031
result2 = DatetimeIndex (np .array (vals , dtype = object ), dtype = dtype )
1032
1032
tm .assert_index_equal (result2 , expected )
1033
1033
1034
- def test_dti_constructor_with_non_nano_now_today (self ):
1034
+ def test_dti_constructor_with_non_nano_now_today (self , request ):
1035
1035
# GH#55756
1036
1036
now = Timestamp .now ()
1037
1037
today = Timestamp .today ()
1038
1038
result = DatetimeIndex (["now" , "today" ], dtype = "M8[s]" )
1039
1039
assert result .dtype == "M8[s]"
1040
1040
1041
+ diff0 = result [0 ] - now .as_unit ("s" )
1042
+ diff1 = result [1 ] - today .as_unit ("s" )
1043
+ assert diff1 >= pd .Timedelta (0 ), f"The difference is { diff0 } "
1044
+ assert diff0 >= pd .Timedelta (0 ), f"The difference is { diff0 } "
1045
+
1041
1046
# result may not exactly match [now, today] so we'll test it up to a tolerance.
1042
1047
# (it *may* match exactly due to rounding)
1048
+ # GH 57535
1049
+ request .applymarker (
1050
+ pytest .mark .xfail (
1051
+ reason = "result may not exactly match [now, today]" , strict = False
1052
+ )
1053
+ )
1043
1054
tolerance = pd .Timedelta (seconds = 1 )
1044
-
1045
- diff0 = result [0 ] - now .as_unit ("s" )
1046
- assert diff0 >= pd .Timedelta (0 ), f"The difference is { diff0 } "
1047
1055
assert diff0 < tolerance , f"The difference is { diff0 } "
1048
-
1049
- diff1 = result [1 ] - today .as_unit ("s" )
1050
- assert diff1 >= pd .Timedelta (0 ), f"The difference is { diff0 } "
1051
1056
assert diff1 < tolerance , f"The difference is { diff0 } "
1052
1057
1053
1058
def test_dti_constructor_object_float_matches_float_dtype (self ):
0 commit comments