|
9 | 9 | import pytz
|
10 | 10 |
|
11 | 11 | from pandas._libs.tslibs import iNaT
|
12 |
| -from pandas.compat import is_numpy_dev |
| 12 | +from pandas.compat.numpy import np_version_gte1p24p3 |
13 | 13 |
|
14 | 14 | from pandas.core.dtypes.common import is_datetime64_any_dtype
|
15 | 15 |
|
@@ -525,24 +525,29 @@ def test_to_numpy_alias():
|
525 | 525 | [
|
526 | 526 | Timedelta(0),
|
527 | 527 | Timedelta(0).to_pytimedelta(),
|
528 |
| - Timedelta(0).to_timedelta64(), |
| 528 | + pytest.param( |
| 529 | + Timedelta(0).to_timedelta64(), |
| 530 | + marks=pytest.mark.xfail( |
| 531 | + not np_version_gte1p24p3, |
| 532 | + reason="td64 doesn't return NotImplemented, see numpy#17017", |
| 533 | + ), |
| 534 | + ), |
529 | 535 | Timestamp(0),
|
530 | 536 | Timestamp(0).to_pydatetime(),
|
531 |
| - Timestamp(0).to_datetime64(), |
| 537 | + pytest.param( |
| 538 | + Timestamp(0).to_datetime64(), |
| 539 | + marks=pytest.mark.xfail( |
| 540 | + not np_version_gte1p24p3, |
| 541 | + reason="dt64 doesn't return NotImplemented, see numpy#17017", |
| 542 | + ), |
| 543 | + ), |
532 | 544 | Timestamp(0).tz_localize("UTC"),
|
533 | 545 | NaT,
|
534 | 546 | ],
|
535 | 547 | )
|
536 |
| -def test_nat_comparisons(compare_operators_no_eq_ne, other, request): |
| 548 | +def test_nat_comparisons(compare_operators_no_eq_ne, other): |
537 | 549 | # GH 26039
|
538 | 550 | 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) |
546 | 551 |
|
547 | 552 | assert getattr(NaT, opname)(other) is False
|
548 | 553 |
|
|
0 commit comments