From f61f5ff8e46d3b6e3fa681005a96e60802e74605 Mon Sep 17 00:00:00 2001 From: Brock Date: Fri, 17 Feb 2023 07:47:04 -0800 Subject: [PATCH 1/3] un-xfail for npdev --- pandas/tests/scalar/test_nat.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pandas/tests/scalar/test_nat.py b/pandas/tests/scalar/test_nat.py index d37a0c7976541..1ef1ba47c33d0 100644 --- a/pandas/tests/scalar/test_nat.py +++ b/pandas/tests/scalar/test_nat.py @@ -9,6 +9,7 @@ import pytz from pandas._libs.tslibs import iNaT +from pandas.compat import is_numpy_dev from pandas.core.dtypes.common import is_datetime64_any_dtype @@ -527,7 +528,8 @@ def test_to_numpy_alias(): pytest.param( Timedelta(0).to_timedelta64(), marks=pytest.mark.xfail( - reason="td64 doesn't return NotImplemented, see numpy#17017" + not is_numpy_dev, + reason="td64 doesn't return NotImplemented, see numpy#17017", ), ), Timestamp(0), @@ -535,7 +537,8 @@ def test_to_numpy_alias(): pytest.param( Timestamp(0).to_datetime64(), marks=pytest.mark.xfail( - reason="dt64 doesn't return NotImplemented, see numpy#17017" + not is_numpy_dev, + reason="dt64 doesn't return NotImplemented, see numpy#17017", ), ), Timestamp(0).tz_localize("UTC"), From 980ce9fa6d0009e1bb418122f96838bfde73c116 Mon Sep 17 00:00:00 2001 From: Brock Date: Fri, 17 Feb 2023 07:50:01 -0800 Subject: [PATCH 2/3] more specific --- pandas/tests/scalar/test_nat.py | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/pandas/tests/scalar/test_nat.py b/pandas/tests/scalar/test_nat.py index 1ef1ba47c33d0..7fed92ed294bb 100644 --- a/pandas/tests/scalar/test_nat.py +++ b/pandas/tests/scalar/test_nat.py @@ -525,29 +525,24 @@ def test_to_numpy_alias(): [ Timedelta(0), Timedelta(0).to_pytimedelta(), - pytest.param( - Timedelta(0).to_timedelta64(), - marks=pytest.mark.xfail( - not is_numpy_dev, - reason="td64 doesn't return NotImplemented, see numpy#17017", - ), - ), + Timedelta(0).to_timedelta64(), Timestamp(0), Timestamp(0).to_pydatetime(), - pytest.param( - Timestamp(0).to_datetime64(), - marks=pytest.mark.xfail( - not is_numpy_dev, - reason="dt64 doesn't return NotImplemented, see numpy#17017", - ), - ), + Timestamp(0).to_datetime64(), Timestamp(0).tz_localize("UTC"), NaT, ], ) -def test_nat_comparisons(compare_operators_no_eq_ne, other): +def test_nat_comparisons(compare_operators_no_eq_ne, other, request): # GH 26039 opname = compare_operators_no_eq_ne + if isinstance(other, (np.datetime64, np.timedleta64)) and ( + opname in ["__eq__", "__ne__"] or not is_numpy_dev + ): + mark = pytest.mark.xfail( + reason="dt64/td64 don't return NotImplemented, see numpy#17017", + ) + request.node.add_marker(mark) assert getattr(NaT, opname)(other) is False From 75916068c9b4946301cdb4c58624ad9a294f5606 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Fri, 17 Feb 2023 09:44:49 -0800 Subject: [PATCH 3/3] Update pandas/tests/scalar/test_nat.py Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> --- pandas/tests/scalar/test_nat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/scalar/test_nat.py b/pandas/tests/scalar/test_nat.py index 7fed92ed294bb..9aae76aab66c8 100644 --- a/pandas/tests/scalar/test_nat.py +++ b/pandas/tests/scalar/test_nat.py @@ -536,7 +536,7 @@ def test_to_numpy_alias(): def test_nat_comparisons(compare_operators_no_eq_ne, other, request): # GH 26039 opname = compare_operators_no_eq_ne - if isinstance(other, (np.datetime64, np.timedleta64)) and ( + if isinstance(other, (np.datetime64, np.timedelta64)) and ( opname in ["__eq__", "__ne__"] or not is_numpy_dev ): mark = pytest.mark.xfail(