Skip to content

Commit 58ba000

Browse files
authored
CLN/TST: Resample fixtures (#56608)
* Make parameterizations more explicit * All tests passing
1 parent f1f17d3 commit 58ba000

File tree

4 files changed

+153
-247
lines changed

4 files changed

+153
-247
lines changed

pandas/tests/resample/conftest.py

-110
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
from datetime import datetime
2-
3-
import numpy as np
41
import pytest
52

6-
from pandas import (
7-
DataFrame,
8-
Series,
9-
)
10-
113
# The various methods we support
124
downsample_methods = [
135
"min",
@@ -39,105 +31,3 @@ def downsample_method(request):
3931
def resample_method(request):
4032
"""Fixture for parametrization of Grouper resample methods."""
4133
return request.param
42-
43-
44-
@pytest.fixture
45-
def _index_start():
46-
"""Fixture for parametrization of index, series and frame."""
47-
return datetime(2005, 1, 1)
48-
49-
50-
@pytest.fixture
51-
def _index_end():
52-
"""Fixture for parametrization of index, series and frame."""
53-
return datetime(2005, 1, 10)
54-
55-
56-
@pytest.fixture
57-
def _index_freq():
58-
"""Fixture for parametrization of index, series and frame."""
59-
return "D"
60-
61-
62-
@pytest.fixture
63-
def _index_name():
64-
"""Fixture for parametrization of index, series and frame."""
65-
return None
66-
67-
68-
@pytest.fixture
69-
def index(_index_factory, _index_start, _index_end, _index_freq, _index_name):
70-
"""
71-
Fixture for parametrization of date_range, period_range and
72-
timedelta_range indexes
73-
"""
74-
return _index_factory(_index_start, _index_end, freq=_index_freq, name=_index_name)
75-
76-
77-
@pytest.fixture
78-
def _static_values(index):
79-
"""
80-
Fixture for parametrization of values used in parametrization of
81-
Series and DataFrames with date_range, period_range and
82-
timedelta_range indexes
83-
"""
84-
return np.arange(len(index))
85-
86-
87-
@pytest.fixture
88-
def _series_name():
89-
"""
90-
Fixture for parametrization of Series name for Series used with
91-
date_range, period_range and timedelta_range indexes
92-
"""
93-
return None
94-
95-
96-
@pytest.fixture
97-
def series(index, _series_name, _static_values):
98-
"""
99-
Fixture for parametrization of Series with date_range, period_range and
100-
timedelta_range indexes
101-
"""
102-
return Series(_static_values, index=index, name=_series_name)
103-
104-
105-
@pytest.fixture
106-
def empty_series_dti(series):
107-
"""
108-
Fixture for parametrization of empty Series with date_range,
109-
period_range and timedelta_range indexes
110-
"""
111-
return series[:0]
112-
113-
114-
@pytest.fixture
115-
def frame(index, _series_name, _static_values):
116-
"""
117-
Fixture for parametrization of DataFrame with date_range, period_range
118-
and timedelta_range indexes
119-
"""
120-
# _series_name is intentionally unused
121-
return DataFrame({"value": _static_values}, index=index)
122-
123-
124-
@pytest.fixture
125-
def empty_frame_dti(series):
126-
"""
127-
Fixture for parametrization of empty DataFrame with date_range,
128-
period_range and timedelta_range indexes
129-
"""
130-
index = series.index[:0]
131-
return DataFrame(index=index)
132-
133-
134-
@pytest.fixture
135-
def series_and_frame(frame_or_series, series, frame):
136-
"""
137-
Fixture for parametrization of Series and DataFrame with date_range,
138-
period_range and timedelta_range indexes
139-
"""
140-
if frame_or_series == Series:
141-
return series
142-
if frame_or_series == DataFrame:
143-
return frame

0 commit comments

Comments
 (0)