Skip to content

Commit 8117460

Browse files
h-vetinarijreback
authored andcommitted
Fixturize tests/frame/test_mutate_columns.py (#25642)
1 parent f2b578c commit 8117460

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

pandas/tests/frame/test_mutate_columns.py

+12-13
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88
from pandas.compat import PY36, lrange, range
99

1010
from pandas import DataFrame, Index, MultiIndex, Series
11-
from pandas.tests.frame.common import TestData
1211
import pandas.util.testing as tm
1312
from pandas.util.testing import assert_frame_equal
1413

1514
# Column add, remove, delete.
1615

1716

18-
class TestDataFrameMutateColumns(TestData):
17+
class TestDataFrameMutateColumns():
1918

2019
def test_assign(self):
2120
df = DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})
@@ -193,9 +192,9 @@ def test_insert(self):
193192
exp = DataFrame(data={'X': ['x', 'y', 'z']}, index=['A', 'B', 'C'])
194193
assert_frame_equal(df, exp)
195194

196-
def test_delitem(self):
197-
del self.frame['A']
198-
assert 'A' not in self.frame
195+
def test_delitem(self, float_frame):
196+
del float_frame['A']
197+
assert 'A' not in float_frame
199198

200199
def test_delitem_multiindex(self):
201200
midx = MultiIndex.from_product([['A', 'B'], [1, 2]])
@@ -223,16 +222,16 @@ def test_delitem_multiindex(self):
223222
with pytest.raises(KeyError):
224223
del df['A']
225224

226-
def test_pop(self):
227-
self.frame.columns.name = 'baz'
225+
def test_pop(self, float_frame):
226+
float_frame.columns.name = 'baz'
228227

229-
self.frame.pop('A')
230-
assert 'A' not in self.frame
228+
float_frame.pop('A')
229+
assert 'A' not in float_frame
231230

232-
self.frame['foo'] = 'bar'
233-
self.frame.pop('foo')
234-
assert 'foo' not in self.frame
235-
assert self.frame.columns.name == 'baz'
231+
float_frame['foo'] = 'bar'
232+
float_frame.pop('foo')
233+
assert 'foo' not in float_frame
234+
assert float_frame.columns.name == 'baz'
236235

237236
# gh-10912: inplace ops cause caching issue
238237
a = DataFrame([[1, 2, 3], [4, 5, 6]], columns=[

0 commit comments

Comments
 (0)