Skip to content

Commit ca6a2d8

Browse files
soumilbaldotaMarcoGorelli
authored andcommitted
fix pylint bad-super-call (pandas-dev#48896)
* fix pylint bad-super-call * fix black pre commit * Update pyproject.toml Co-authored-by: Marco Edward Gorelli <[email protected]> * change super() to df.copy() Co-authored-by: Marco Edward Gorelli <[email protected]>
1 parent 6182a81 commit ca6a2d8

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

pandas/tests/extension/json/test_json.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class TestConstructors(BaseJSON, base.BaseConstructorsTests):
159159
@pytest.mark.xfail(reason="not implemented constructor from dtype")
160160
def test_from_dtype(self, data):
161161
# construct from our dtype & string dtype
162-
super(self).test_from_dtype(data)
162+
super().test_from_dtype(data)
163163

164164
@pytest.mark.xfail(reason="RecursionError, GH-33900")
165165
def test_series_constructor_no_data_with_index(self, dtype, na_value):

pandas/tests/extension/test_sparse.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def test_fillna_series_method(self, data_missing):
268268
@pytest.mark.xfail(reason="Unsupported")
269269
def test_fillna_series(self):
270270
# this one looks doable.
271-
super(self).test_fillna_series()
271+
super().test_fillna_series()
272272

273273
def test_fillna_frame(self, data_missing):
274274
# Have to override to specify that fill_value will change.

pandas/tests/generic/test_frame.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -157,27 +157,25 @@ def test_validate_bool_args(self, value):
157157

158158
msg = 'For argument "inplace" expected type bool, received type'
159159
with pytest.raises(ValueError, match=msg):
160-
super(DataFrame, df).rename_axis(
161-
mapper={"a": "x", "b": "y"}, axis=1, inplace=value
162-
)
160+
df.copy().rename_axis(mapper={"a": "x", "b": "y"}, axis=1, inplace=value)
163161

164162
with pytest.raises(ValueError, match=msg):
165-
super(DataFrame, df).drop("a", axis=1, inplace=value)
163+
df.copy().drop("a", axis=1, inplace=value)
166164

167165
with pytest.raises(ValueError, match=msg):
168-
super(DataFrame, df).fillna(value=0, inplace=value)
166+
df.copy().fillna(value=0, inplace=value)
169167

170168
with pytest.raises(ValueError, match=msg):
171-
super(DataFrame, df).replace(to_replace=1, value=7, inplace=value)
169+
df.copy().replace(to_replace=1, value=7, inplace=value)
172170

173171
with pytest.raises(ValueError, match=msg):
174-
super(DataFrame, df).interpolate(inplace=value)
172+
df.copy().interpolate(inplace=value)
175173

176174
with pytest.raises(ValueError, match=msg):
177-
super(DataFrame, df)._where(cond=df.a > 2, inplace=value)
175+
df.copy()._where(cond=df.a > 2, inplace=value)
178176

179177
with pytest.raises(ValueError, match=msg):
180-
super(DataFrame, df).mask(cond=df.a > 2, inplace=value)
178+
df.copy().mask(cond=df.a > 2, inplace=value)
181179

182180
def test_unexpected_keyword(self):
183181
# GH8597

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ disable = [
3939
"W",
4040
"abstract-class-instantiated",
4141
"access-member-before-definition",
42-
"bad-super-call",
4342
"c-extension-no-member",
4443
"import-error",
4544
"invalid-repr-returned",

0 commit comments

Comments
 (0)