Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pandas/_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1429,6 +1429,8 @@ def assert_equal(left, right, **kwargs):

if isinstance(left, pd.Index):
assert_index_equal(left, right, **kwargs)
if isinstance(left, (pd.DatetimeIndex, pd.TimedeltaIndex)):
assert left.freq == right.freq, (left.freq, right.freq)
elif isinstance(left, pd.Series):
assert_series_equal(left, right, **kwargs)
elif isinstance(left, pd.DataFrame):
Expand Down
5 changes: 3 additions & 2 deletions pandas/tests/arithmetic/test_datetime64.py
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ def test_dt64arr_add_sub_td64ndarray(self, tz_naive_fixture, box_with_array):
)
def test_dt64arr_sub_dtscalar(self, box_with_array, ts):
# GH#8554, GH#22163 DataFrame op should _not_ return dt64 dtype
idx = pd.date_range("2013-01-01", periods=3)
idx = pd.date_range("2013-01-01", periods=3)._with_freq(None)
idx = tm.box_expected(idx, box_with_array)

expected = pd.TimedeltaIndex(["0 Days", "1 Day", "2 Days"])
Expand All @@ -912,7 +912,7 @@ def test_dt64arr_sub_datetime64_not_ns(self, box_with_array):
dt64 = np.datetime64("2013-01-01")
assert dt64.dtype == "datetime64[D]"

dti = pd.date_range("20130101", periods=3)
dti = pd.date_range("20130101", periods=3)._with_freq(None)
dtarr = tm.box_expected(dti, box_with_array)

expected = pd.TimedeltaIndex(["0 Days", "1 Day", "2 Days"])
Expand All @@ -926,6 +926,7 @@ def test_dt64arr_sub_datetime64_not_ns(self, box_with_array):

def test_dt64arr_sub_timestamp(self, box_with_array):
ser = pd.date_range("2014-03-17", periods=2, freq="D", tz="US/Eastern")
ser = ser._with_freq(None)
ts = ser[0]

ser = tm.box_expected(ser, box_with_array)
Expand Down