Skip to content

Commit f0a4c43

Browse files
simonjayhawkinsjreback
authored andcommitted
TST/CLN: use float_frame fixture to remove use of tm.getSeriesData() (#26787)
1 parent 370054e commit f0a4c43

File tree

6 files changed

+12
-25
lines changed

6 files changed

+12
-25
lines changed

pandas/tests/arithmetic/test_numeric.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -712,10 +712,9 @@ def test_datetime64_with_index(self):
712712
tm.assert_series_equal(df['result'], df['expected'], check_names=False)
713713

714714
# TODO: taken from tests.frame.test_operators, needs cleanup
715-
def test_frame_operators(self):
716-
seriesd = tm.getSeriesData()
717-
frame = pd.DataFrame(seriesd)
718-
frame2 = pd.DataFrame(seriesd, columns=['D', 'C', 'B', 'A'])
715+
def test_frame_operators(self, float_frame):
716+
frame = float_frame
717+
frame2 = pd.DataFrame(float_frame, columns=['D', 'C', 'B', 'A'])
719718

720719
garbage = np.random.random(4)
721720
colSeries = pd.Series(garbage, index=np.array(frame.columns))

pandas/tests/frame/test_operators.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ def test_neg_raises(self, df):
4848
with pytest.raises(TypeError):
4949
(- df['a'])
5050

51-
def test_invert(self):
52-
_seriesd = tm.getSeriesData()
53-
df = pd.DataFrame(_seriesd)
51+
def test_invert(self, float_frame):
52+
df = float_frame
5453

5554
assert_frame_equal(-(df < 0), ~(df < 0))
5655

pandas/tests/groupby/conftest.py

-10
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,11 @@ def ts():
3030
return tm.makeTimeSeries()
3131

3232

33-
@pytest.fixture
34-
def seriesd():
35-
return tm.getSeriesData()
36-
37-
3833
@pytest.fixture
3934
def tsd():
4035
return tm.getTimeSeriesData()
4136

4237

43-
@pytest.fixture
44-
def frame(seriesd):
45-
return DataFrame(seriesd)
46-
47-
4838
@pytest.fixture
4939
def tsframe(tsd):
5040
return DataFrame(tsd)

pandas/tests/groupby/test_groupby.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1306,12 +1306,12 @@ def test_skip_group_keys():
13061306
assert_series_equal(result, expected)
13071307

13081308

1309-
def test_no_nonsense_name(frame):
1309+
def test_no_nonsense_name(float_frame):
13101310
# GH #995
1311-
s = frame['C'].copy()
1311+
s = float_frame['C'].copy()
13121312
s.name = None
13131313

1314-
result = s.groupby(frame['A']).agg(np.sum)
1314+
result = s.groupby(float_frame['A']).agg(np.sum)
13151315
assert result.name is None
13161316

13171317

pandas/tests/indexing/test_ix.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ def test_ix_weird_slicing(self):
182182
4: 5}})
183183
tm.assert_frame_equal(df, expected)
184184

185-
def test_ix_assign_column_mixed(self):
185+
def test_ix_assign_column_mixed(self, float_frame):
186186
# GH #1142
187-
df = DataFrame(tm.getSeriesData())
187+
df = float_frame
188188
df['foo'] = 'bar'
189189

190190
orig = df.loc[:, 'B'].copy()

pandas/tests/io/formats/test_to_html.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,8 @@ def test_to_html_with_no_bold():
287287
assert '<strong' not in result
288288

289289

290-
def test_to_html_columns_arg():
291-
df = DataFrame(tm.getSeriesData())
292-
result = df.to_html(columns=['A'])
290+
def test_to_html_columns_arg(float_frame):
291+
result = float_frame.to_html(columns=['A'])
293292
assert '<th>B</th>' not in result
294293

295294

0 commit comments

Comments
 (0)