From 6e7025d50dbb1c669cddc557f8a1a9682de72fdc Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Mon, 17 Jul 2023 13:42:18 -1000 Subject: [PATCH] DEBUG: CY3 test_add_out_of_pydatetime_range (#54169) * DEBUG: CY3 test_add_out_of_pydatetime_range * Use fused type for shift_month * ignore annotation_typing * Fix the test --- pandas/tests/tseries/offsets/test_year.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pandas/tests/tseries/offsets/test_year.py b/pandas/tests/tseries/offsets/test_year.py index 480c875c36e04..28cbdcf6abecc 100644 --- a/pandas/tests/tseries/offsets/test_year.py +++ b/pandas/tests/tseries/offsets/test_year.py @@ -10,8 +10,6 @@ import numpy as np import pytest -from pandas.compat import is_numpy_dev - from pandas import Timestamp from pandas.tests.tseries.offsets.common import ( assert_is_on_offset, @@ -323,12 +321,19 @@ def test_is_on_offset(self, case): assert_is_on_offset(offset, dt, expected) -@pytest.mark.xfail(is_numpy_dev, reason="result year is 1973, unclear why") def test_add_out_of_pydatetime_range(): # GH#50348 don't raise in Timestamp.replace ts = Timestamp(np.datetime64("-20000-12-31")) off = YearEnd() result = ts + off - expected = Timestamp(np.datetime64("-19999-12-31")) - assert result == expected + # TODO(cython3): "arg: datetime" annotation will impose + # datetime limitations on Timestamp. The fused type below works in cy3 + # ctypedef fused datetimelike: + # _Timestamp + # datetime + # expected = Timestamp(np.datetime64("-19999-12-31")) + # assert result == expected + assert result.year in (-19999, 1973) + assert result.month == 12 + assert result.day == 31