Skip to content

Commit cb9c023

Browse files
committed
TST: improve timedelta tests
1 parent 5a19b3e commit cb9c023

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

pandas/tests/resample/test_timedelta.py

+16-4
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,18 @@ def test_resample_timedelta_values():
131131
@pytest.mark.parametrize(
132132
"start, end, freq, resample_freq",
133133
[
134-
("8H", "21h59min", "10S", "3H"),
134+
("8H", "21h59min50s", "10S", "3H"), # GH 30353 example
135135
("3H", "22H", "1H", "5H"),
136136
("527D", "5006D", "3D", "10D"),
137+
("1D", "10D", "1D", "2D"), # GH 13022 example
138+
# tests that worked before GH 33498:
139+
("8H", "21h59min50s", "10S", "2H"),
140+
("0H", "21h59min50s", "10S", "3H"),
141+
("10D", "85D", "D", "2D"),
137142
],
138143
)
139144
def test_resample_timedelta_edge_case(start, end, freq, resample_freq):
140-
# GH 30353
145+
# GH 33498
141146
# check that the timedelta bins does not contains an extra bin
142147
idx = pd.timedelta_range(start=start, end=end, freq=freq)
143148
s = pd.Series(np.arange(len(idx)), index=idx)
@@ -149,10 +154,17 @@ def test_resample_timedelta_edge_case(start, end, freq, resample_freq):
149154

150155
@pytest.mark.parametrize(
151156
"start, end, freq",
152-
[("1day", "10day", "2D"), ("2day", "30day", "3D"), ("2s", "50s", "5s")],
157+
[
158+
("1D", "10D", "2D"),
159+
("2D", "30D", "3D"),
160+
("2s", "50s", "5s"),
161+
# tests that worked before GH 33498:
162+
("4D", "16D", "3D"),
163+
("8D", "16D", "40s"),
164+
],
153165
)
154166
def test_timedelta_range_freq_divide_end(start, end, freq):
155-
# GH 30353 only the cases where `(end % freq) == 0` used to fail
167+
# GH 33498 only the cases where `(end % freq) == 0` used to fail
156168

157169
def mock_timedelta_range(start=None, end=None, **kwargs):
158170
epoch = pd.Timestamp(0)

0 commit comments

Comments
 (0)