Skip to content

Commit 9d38060

Browse files
copy test from pandas-dev#36582
1 parent 2faea7f commit 9d38060

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

pandas/tests/arithmetic/test_timedelta64.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2137,7 +2137,19 @@ def test_td64arr_pow_invalid(self, scalar_td, box_with_array):
21372137
with pytest.raises(TypeError, match=pattern):
21382138
td1 ** scalar_td
21392139

2140-
def test_add_timestamp_to_timedelta(self):
2141-
# https://github.com/pandas-dev/pandas/issues/35897
2142-
result = Timestamp.now() + timedelta_range("0s", "1s", periods=31)
2143-
assert result.freq is None
2140+
2141+
def test_add_timestamp_to_timedelta():
2142+
# GH: 35897
2143+
timestamp = pd.Timestamp.now()
2144+
result = timestamp + pd.timedelta_range("0s", "1s", periods=31)
2145+
expected = pd.DatetimeIndex(
2146+
[
2147+
timestamp
2148+
+ (
2149+
pd.to_timedelta("0.033333333s") * i
2150+
+ pd.to_timedelta("0.000000001s") * divmod(i, 3)[0]
2151+
)
2152+
for i in range(31)
2153+
]
2154+
)
2155+
tm.assert_index_equal(result, expected)

0 commit comments

Comments
 (0)