Skip to content
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

Fixed mypy errors in pandas/tests/extension/json/test_json.py #31836

Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 6 additions & 4 deletions pandas/tests/extension/json/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ class BaseJSON:
# The default assert_series_equal eventually does a
# Series.values, which raises. We work around it by
# converting the UserDicts to dicts.
def assert_series_equal(self, left, right, **kwargs):
@classmethod
def assert_series_equal(cls, left, right, *args, **kwargs):
if left.dtype.name == "json":
assert left.dtype == right.dtype
left = pd.Series(
Expand All @@ -90,9 +91,10 @@ def assert_series_equal(self, left, right, **kwargs):
index=right.index,
name=right.name,
)
tm.assert_series_equal(left, right, **kwargs)
tm.assert_series_equal(left, right, *args, **kwargs)

def assert_frame_equal(self, left, right, *args, **kwargs):
@classmethod
def assert_frame_equal(cls, left, right, *args, **kwargs):
obj_type = kwargs.get("obj", "DataFrame")
tm.assert_index_equal(
left.columns,
Expand All @@ -107,7 +109,7 @@ def assert_frame_equal(self, left, right, *args, **kwargs):
jsons = (left.dtypes == "json").index

for col in jsons:
self.assert_series_equal(left[col], right[col], *args, **kwargs)
cls.assert_series_equal(left[col], right[col], *args, **kwargs)

left = left.drop(columns=jsons)
right = right.drop(columns=jsons)
Expand Down
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,6 @@ ignore_errors=True
[mypy-pandas.tests.arithmetic.test_datetime64]
ignore_errors=True

[mypy-pandas.tests.extension.json.test_json]
ignore_errors=True

[mypy-pandas.tests.indexes.datetimes.test_tools]
ignore_errors=True

Expand Down