Skip to content

TST: More pytest idioms in tests/generic #45086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 28, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions pandas/tests/generic/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,10 @@
date_range,
)
import pandas._testing as tm
from pandas.tests.generic.test_generic import Generic
from pandas.tests.generic.test_generic import check_metadata


class TestDataFrame(Generic):
_typ = DataFrame
_comparator = lambda self, x, y: tm.assert_frame_equal(x, y)

class TestDataFrame:
@pytest.mark.parametrize("func", ["_set_axis_name", "rename_axis"])
def test_set_axis_name(self, func):
df = DataFrame([[1, 2], [3, 4]])
Expand Down Expand Up @@ -76,7 +73,7 @@ def test_metadata_propagation_indiv_groupby(self):
}
)
result = df.groupby("A").sum()
self.check_metadata(df, result)
check_metadata(df, result)

def test_metadata_propagation_indiv_resample(self):
# resample
Expand All @@ -85,7 +82,7 @@ def test_metadata_propagation_indiv_resample(self):
index=date_range("20130101", periods=1000, freq="s"),
)
result = df.resample("1T")
self.check_metadata(df, result)
check_metadata(df, result)

def test_metadata_propagation_indiv(self, monkeypatch):
# merging with override
Expand Down Expand Up @@ -148,7 +145,7 @@ def test_deepcopy_empty(self):
empty_frame = DataFrame(data=[], index=[], columns=["A"])
empty_frame_copy = deepcopy(empty_frame)

self._compare(empty_frame_copy, empty_frame)
tm.assert_frame_equal(empty_frame_copy, empty_frame)


# formerly in Generic but only test DataFrame
Expand Down
Loading