From 81174601881af75033d9a43be06396a55cc17086 Mon Sep 17 00:00:00 2001 From: h-vetinari <33685575+h-vetinari@users.noreply.github.com> Date: Sun, 10 Mar 2019 22:54:54 +0100 Subject: [PATCH] Fixturize tests/frame/test_mutate_columns.py (#25642) --- pandas/tests/frame/test_mutate_columns.py | 25 +++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/pandas/tests/frame/test_mutate_columns.py b/pandas/tests/frame/test_mutate_columns.py index 6bef7e3f65b21..211173371ac7e 100644 --- a/pandas/tests/frame/test_mutate_columns.py +++ b/pandas/tests/frame/test_mutate_columns.py @@ -8,14 +8,13 @@ from pandas.compat import PY36, lrange, range from pandas import DataFrame, Index, MultiIndex, Series -from pandas.tests.frame.common import TestData import pandas.util.testing as tm from pandas.util.testing import assert_frame_equal # Column add, remove, delete. -class TestDataFrameMutateColumns(TestData): +class TestDataFrameMutateColumns(): def test_assign(self): df = DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]}) @@ -193,9 +192,9 @@ def test_insert(self): exp = DataFrame(data={'X': ['x', 'y', 'z']}, index=['A', 'B', 'C']) assert_frame_equal(df, exp) - def test_delitem(self): - del self.frame['A'] - assert 'A' not in self.frame + def test_delitem(self, float_frame): + del float_frame['A'] + assert 'A' not in float_frame def test_delitem_multiindex(self): midx = MultiIndex.from_product([['A', 'B'], [1, 2]]) @@ -223,16 +222,16 @@ def test_delitem_multiindex(self): with pytest.raises(KeyError): del df['A'] - def test_pop(self): - self.frame.columns.name = 'baz' + def test_pop(self, float_frame): + float_frame.columns.name = 'baz' - self.frame.pop('A') - assert 'A' not in self.frame + float_frame.pop('A') + assert 'A' not in float_frame - self.frame['foo'] = 'bar' - self.frame.pop('foo') - assert 'foo' not in self.frame - assert self.frame.columns.name == 'baz' + float_frame['foo'] = 'bar' + float_frame.pop('foo') + assert 'foo' not in float_frame + assert float_frame.columns.name == 'baz' # gh-10912: inplace ops cause caching issue a = DataFrame([[1, 2, 3], [4, 5, 6]], columns=[