Skip to content

Commit

Permalink
DEBUG: CY3 test_add_out_of_pydatetime_range (#54169)
Browse files Browse the repository at this point in the history
* DEBUG: CY3 test_add_out_of_pydatetime_range

* Use fused type for shift_month

* ignore annotation_typing

* Fix the test
  • Loading branch information
mroeschke authored Jul 17, 2023
1 parent 6dbc455 commit 6e7025d
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pandas/tests/tseries/offsets/test_year.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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

0 comments on commit 6e7025d

Please sign in to comment.