Skip to content

Commit 4965c51

Browse files
TST: un-xfail NaT test on npdev (#51455)
* un-xfail for npdev * more specific * Update pandas/tests/scalar/test_nat.py Co-authored-by: Matthew Roeschke <[email protected]> --------- Co-authored-by: Matthew Roeschke <[email protected]>
1 parent a162c40 commit 4965c51

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

Diff for: pandas/tests/scalar/test_nat.py

+11-13
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import pytz
1010

1111
from pandas._libs.tslibs import iNaT
12+
from pandas.compat import is_numpy_dev
1213

1314
from pandas.core.dtypes.common import is_datetime64_any_dtype
1415

@@ -524,27 +525,24 @@ def test_to_numpy_alias():
524525
[
525526
Timedelta(0),
526527
Timedelta(0).to_pytimedelta(),
527-
pytest.param(
528-
Timedelta(0).to_timedelta64(),
529-
marks=pytest.mark.xfail(
530-
reason="td64 doesn't return NotImplemented, see numpy#17017"
531-
),
532-
),
528+
Timedelta(0).to_timedelta64(),
533529
Timestamp(0),
534530
Timestamp(0).to_pydatetime(),
535-
pytest.param(
536-
Timestamp(0).to_datetime64(),
537-
marks=pytest.mark.xfail(
538-
reason="dt64 doesn't return NotImplemented, see numpy#17017"
539-
),
540-
),
531+
Timestamp(0).to_datetime64(),
541532
Timestamp(0).tz_localize("UTC"),
542533
NaT,
543534
],
544535
)
545-
def test_nat_comparisons(compare_operators_no_eq_ne, other):
536+
def test_nat_comparisons(compare_operators_no_eq_ne, other, request):
546537
# GH 26039
547538
opname = compare_operators_no_eq_ne
539+
if isinstance(other, (np.datetime64, np.timedelta64)) and (
540+
opname in ["__eq__", "__ne__"] or not is_numpy_dev
541+
):
542+
mark = pytest.mark.xfail(
543+
reason="dt64/td64 don't return NotImplemented, see numpy#17017",
544+
)
545+
request.node.add_marker(mark)
548546

549547
assert getattr(NaT, opname)(other) is False
550548

0 commit comments

Comments
 (0)