Skip to content

Commit 1ec0472

Browse files
meeseeksmachinejreback
authored andcommitted
Backport PR #25262: REF/TST: resample/test_base.py (#25718)
1 parent 95938db commit 1ec0472

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

pandas/tests/resample/test_base.py

+18-16
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,10 @@
2828
period_range, 'pi', datetime(2005, 1, 1), datetime(2005, 1, 10))
2929
TIMEDELTA_RANGE = (timedelta_range, 'tdi', '1 day', '10 day')
3030

31-
ALL_TIMESERIES_INDEXES = [DATE_RANGE, PERIOD_RANGE, TIMEDELTA_RANGE]
32-
33-
34-
def pytest_generate_tests(metafunc):
35-
# called once per each test function
36-
if metafunc.function.__name__.endswith('_all_ts'):
37-
metafunc.parametrize(
38-
'_index_factory,_series_name,_index_start,_index_end',
39-
ALL_TIMESERIES_INDEXES)
31+
all_ts = pytest.mark.parametrize(
32+
'_index_factory,_series_name,_index_start,_index_end',
33+
[DATE_RANGE, PERIOD_RANGE, TIMEDELTA_RANGE]
34+
)
4035

4136

4237
@pytest.fixture
@@ -84,7 +79,8 @@ def test_asfreq_fill_value(series, create_index):
8479
assert_frame_equal(result, expected)
8580

8681

87-
def test_resample_interpolate_all_ts(frame):
82+
@all_ts
83+
def test_resample_interpolate(frame):
8884
# # 12925
8985
df = frame
9086
assert_frame_equal(
@@ -98,8 +94,9 @@ def test_raises_on_non_datetimelike_index():
9894
pytest.raises(TypeError, lambda: xp.resample('A').mean())
9995

10096

97+
@all_ts
10198
@pytest.mark.parametrize('freq', ['M', 'D', 'H'])
102-
def test_resample_empty_series_all_ts(freq, empty_series, resample_method):
99+
def test_resample_empty_series(freq, empty_series, resample_method):
103100
# GH12771 & GH12868
104101

105102
if resample_method == 'ohlc':
@@ -118,8 +115,9 @@ def test_resample_empty_series_all_ts(freq, empty_series, resample_method):
118115
assert_series_equal(result, expected, check_dtype=False)
119116

120117

118+
@all_ts
121119
@pytest.mark.parametrize('freq', ['M', 'D', 'H'])
122-
def test_resample_empty_dataframe_all_ts(empty_frame, freq, resample_method):
120+
def test_resample_empty_dataframe(empty_frame, freq, resample_method):
123121
# GH13212
124122
df = empty_frame
125123
# count retains dimensions too
@@ -159,7 +157,8 @@ def test_resample_empty_dtypes(index, dtype, resample_method):
159157
pass
160158

161159

162-
def test_resample_loffset_arg_type_all_ts(frame, create_index):
160+
@all_ts
161+
def test_resample_loffset_arg_type(frame, create_index):
163162
# GH 13218, 15002
164163
df = frame
165164
expected_means = [df.values[i:i + 2].mean()
@@ -197,7 +196,8 @@ def test_resample_loffset_arg_type_all_ts(frame, create_index):
197196
assert_frame_equal(result_how, expected)
198197

199198

200-
def test_apply_to_empty_series_all_ts(empty_series):
199+
@all_ts
200+
def test_apply_to_empty_series(empty_series):
201201
# GH 14313
202202
s = empty_series
203203
for freq in ['M', 'D', 'H']:
@@ -207,7 +207,8 @@ def test_apply_to_empty_series_all_ts(empty_series):
207207
assert_series_equal(result, expected, check_dtype=False)
208208

209209

210-
def test_resampler_is_iterable_all_ts(series):
210+
@all_ts
211+
def test_resampler_is_iterable(series):
211212
# GH 15314
212213
freq = 'H'
213214
tg = TimeGrouper(freq, convention='start')
@@ -218,7 +219,8 @@ def test_resampler_is_iterable_all_ts(series):
218219
assert_series_equal(rv, gv)
219220

220221

221-
def test_resample_quantile_all_ts(series):
222+
@all_ts
223+
def test_resample_quantile(series):
222224
# GH 15023
223225
s = series
224226
q = 0.75

0 commit comments

Comments
 (0)