Skip to content

Commit f42793a

Browse files
committed
Review (jreback) fixtures
1 parent 61b252d commit f42793a

File tree

2 files changed

+90
-141
lines changed

2 files changed

+90
-141
lines changed

pandas/tests/frame/conftest.py

+29-81
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,32 @@
77
from pandas import DataFrame, date_range, NaT
88

99

10-
# This module is the start of transitioning from attributes of
11-
# pandas/tests/frame/common.TestData towards fixtures (GH22471).
12-
# Until all modules have been transitioned, it is advised not to change
13-
# the (admittedly suboptimal) names of these fixtures.
14-
1510
@pytest.fixture
16-
def frame():
11+
def float_frame():
1712
"""
1813
Fixture for DataFrame of floats with index of unique strings
1914
20-
After completing the fixturization of the frame tests (GH 22471), this
21-
fixture will be renamed to: float_frame_string_index
22-
23-
Columns are ['A', 'B', 'C', 'D'], see pandas.util.testing.getSeriesData
15+
Columns are ['A', 'B', 'C', 'D'].
2416
"""
2517
return DataFrame(tm.getSeriesData())
2618

2719

2820
@pytest.fixture
29-
def frame2():
21+
def float_frame2():
3022
"""
3123
Fixture for DataFrame of floats with index of unique strings
3224
33-
After completing the fixturization of the frame tests (GH 22471), this
34-
fixture will be renamed to: float_frame_string_index2
35-
36-
Columns are ['D', 'C', 'B', 'A']. See pandas.util.testing.getSeriesData
25+
Columns are ['D', 'C', 'B', 'A']
3726
"""
3827
return DataFrame(tm.getSeriesData(), columns=['D', 'C', 'B', 'A'])
3928

4029

4130
@pytest.fixture
42-
def intframe():
31+
def int_frame():
4332
"""
4433
Fixture for DataFrame of ints with index of unique strings
4534
46-
After completing the fixturization of the frame tests (GH 22471), this
47-
fixture will be renamed to: int_frame
48-
49-
Columns are ['A', 'B', 'C', 'D']. See pandas.util.testing.getSeriesData
35+
Columns are ['A', 'B', 'C', 'D']
5036
"""
5137
df = DataFrame({k: v.astype(int)
5238
for k, v in compat.iteritems(tm.getSeriesData())})
@@ -55,43 +41,33 @@ def intframe():
5541

5642

5743
@pytest.fixture
58-
def tsframe():
44+
def datetime_frame():
5945
"""
6046
Fixture for DataFrame of floats with DatetimeIndex
6147
62-
After completing the fixturization of the frame tests (GH 22471), this
63-
fixture will be renamed to: float_frame_datetime_index
64-
65-
Columns are ['A', 'B', 'C', 'D']. See pandas.util.testing.getTimeSeriesData
48+
Columns are ['A', 'B', 'C', 'D']
6649
"""
6750
return DataFrame(tm.getTimeSeriesData())
6851

6952

7053
@pytest.fixture
71-
def mixed_frame():
54+
def float_string_frame():
7255
"""
73-
Fixture for DataFrame of floats and strings with string index
74-
75-
After completing the fixturization of the frame tests (GH 22471), this
76-
fixture will be renamed to: float_string_frame
56+
Fixture for DataFrame of floats and strings with index of unique strings
7757
7858
Columns are ['A', 'B', 'C', 'D', 'foo'].
79-
See pandas.util.testing.getSeriesData
8059
"""
8160
df = DataFrame(tm.getSeriesData())
8261
df['foo'] = 'bar'
8362
return df
8463

8564

8665
@pytest.fixture
87-
def mixed_float():
66+
def mixed_float_frame():
8867
"""
89-
Fixture for DataFrame of different float types with string index
90-
91-
After completing the fixturization of the frame tests (GH 22471), this
92-
fixture will be renamed to: mixed_float_frame
68+
Fixture for DataFrame of different float types with index of unique strings
9369
94-
Columns are ['A', 'B', 'C', 'D']. See pandas.util.testing.getSeriesData
70+
Columns are ['A', 'B', 'C', 'D'].
9571
"""
9672
df = DataFrame(tm.getSeriesData())
9773
df.A = df.A.astype('float16')
@@ -101,14 +77,11 @@ def mixed_float():
10177

10278

10379
@pytest.fixture
104-
def mixed_float2():
80+
def mixed_float_frame2():
10581
"""
106-
Fixture for DataFrame of different float types with string index
82+
Fixture for DataFrame of different float types with index of unique strings
10783
108-
After completing the fixturization of the frame tests (GH 22471), this
109-
fixture will be renamed to: mixed_float_frame2
110-
111-
Columns are ['A', 'B', 'C', 'D']. See pandas.util.testing.getSeriesData
84+
Columns are ['A', 'B', 'C', 'D'].
11285
"""
11386
df = DataFrame(tm.getSeriesData())
11487
df.D = df.D.astype('float16')
@@ -118,14 +91,11 @@ def mixed_float2():
11891

11992

12093
@pytest.fixture
121-
def mixed_int():
94+
def mixed_int_frame():
12295
"""
123-
Fixture for DataFrame of different int types with string index
124-
125-
After completing the fixturization of the frame tests (GH 22471), this
126-
fixture will be renamed to: mixed_int_frame
96+
Fixture for DataFrame of different int types with index of unique strings
12797
128-
Columns are ['A', 'B', 'C', 'D']. See pandas.util.testing.getSeriesData
98+
Columns are ['A', 'B', 'C', 'D'].
12999
"""
130100
df = DataFrame({k: v.astype(int)
131101
for k, v in compat.iteritems(tm.getSeriesData())})
@@ -137,12 +107,9 @@ def mixed_int():
137107

138108

139109
@pytest.fixture
140-
def all_mixed():
110+
def mixed_type_frame():
141111
"""
142-
Fixture for DataFrame of float/int/string columns
143-
144-
After completing the fixturization of the frame tests (GH 22471), this
145-
fixture will be renamed to: float_int_string_frame
112+
Fixture for DataFrame of float/int/string columns with RangeIndex
146113
147114
Columns are ['a', 'b', 'c', 'float32', 'int32'].
148115
"""
@@ -153,12 +120,9 @@ def all_mixed():
153120

154121

155122
@pytest.fixture
156-
def tzframe():
123+
def timezone_frame():
157124
"""
158-
Fixture for DataFrame of date_range Series with different timezones
159-
160-
After completing the fixturization of the frame tests (GH 22471), this
161-
fixture will be renamed to: timezone_frame
125+
Fixture for DataFrame of date_range Series with different time zones
162126
163127
Columns are ['A', 'B', 'C']; some entries are missing
164128
"""
@@ -173,50 +137,34 @@ def tzframe():
173137

174138

175139
@pytest.fixture
176-
def empty():
140+
def empty_frame():
177141
"""
178142
Fixture for empty DataFrame
179-
180-
After completing the fixturization of the frame tests (GH 22471), this
181-
fixture will be renamed to: empty_frame
182143
"""
183144
return DataFrame({})
184145

185146

186147
@pytest.fixture
187-
def ts1():
148+
def datetime_series():
188149
"""
189150
Fixture for Series of floats with DatetimeIndex
190-
191-
After completing the fixturization of the frame tests (GH 22471), this
192-
fixture will be renamed to: datetime_series
193-
194-
See pandas.util.testing.makeTimeSeries
195151
"""
196152
return tm.makeTimeSeries(nper=30)
197153

198154

199155
@pytest.fixture
200-
def ts2():
156+
def datetime_series_short():
201157
"""
202158
Fixture for Series of floats with DatetimeIndex
203-
204-
After completing the fixturization of the frame tests (GH 22471), this
205-
fixture will be renamed to: datetime_series_short
206-
207-
See pandas.util.testing.makeTimeSeries
208159
"""
209160
return tm.makeTimeSeries(nper=30)[5:]
210161

211162

212163
@pytest.fixture
213-
def simple():
164+
def simple_frame():
214165
"""
215166
Fixture for simple 3x3 DataFrame
216167
217-
After completing the fixturization of the frame tests (GH 22471), this
218-
fixture will be renamed to: simple_frame
219-
220168
Columns are ['one', 'two', 'three'], index is ['a', 'b', 'c'].
221169
"""
222170
arr = np.array([[1., 2., 3.],
@@ -232,8 +180,8 @@ def frame_of_index_cols():
232180
"""
233181
Fixture for DataFrame of columns that can be used for indexing
234182
235-
Columns are ['A', 'B', 'C', 'D', 'E']; 'A' & 'B' contain duplicates,
236-
the rest are unique.
183+
Columns are ['A', 'B', 'C', 'D', 'E']; 'A' & 'B' contain duplicates (but
184+
are jointly unique), the rest are unique.
237185
"""
238186
df = DataFrame({'A': ['foo', 'foo', 'foo', 'bar', 'bar'],
239187
'B': ['one', 'two', 'three', 'one', 'two'],

0 commit comments

Comments
 (0)