|
9 | 9 | import pytz
|
10 | 10 |
|
11 | 11 | from pandas._libs.tslibs import iNaT
|
| 12 | +from pandas.compat import is_numpy_dev |
12 | 13 |
|
13 | 14 | from pandas.core.dtypes.common import is_datetime64_any_dtype
|
14 | 15 |
|
@@ -524,27 +525,24 @@ def test_to_numpy_alias():
|
524 | 525 | [
|
525 | 526 | Timedelta(0),
|
526 | 527 | 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(), |
533 | 529 | Timestamp(0),
|
534 | 530 | 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(), |
541 | 532 | Timestamp(0).tz_localize("UTC"),
|
542 | 533 | NaT,
|
543 | 534 | ],
|
544 | 535 | )
|
545 |
| -def test_nat_comparisons(compare_operators_no_eq_ne, other): |
| 536 | +def test_nat_comparisons(compare_operators_no_eq_ne, other, request): |
546 | 537 | # GH 26039
|
547 | 538 | 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) |
548 | 546 |
|
549 | 547 | assert getattr(NaT, opname)(other) is False
|
550 | 548 |
|
|
0 commit comments