Skip to content

Commit faae2f0

Browse files
authored
CLN: remove unnecessary trailing commas on issues #35925 (#36193)
1 parent 44e933a commit faae2f0

File tree

8 files changed

+15
-32
lines changed

8 files changed

+15
-32
lines changed

pandas/tests/arrays/categorical/test_replace.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,5 @@ def test_replace(to_replace, value, expected, flip_categories):
4343
# the replace call loses categorical dtype
4444
expected = pd.Series(np.asarray(expected))
4545

46-
tm.assert_series_equal(
47-
expected, result, check_category_order=False,
48-
)
49-
tm.assert_series_equal(
50-
expected, s, check_category_order=False,
51-
)
46+
tm.assert_series_equal(expected, result, check_category_order=False)
47+
tm.assert_series_equal(expected, s, check_category_order=False)

pandas/tests/arrays/test_array.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
np.dtype("float32"),
3636
PandasArray(np.array([1.0, 2.0], dtype=np.dtype("float32"))),
3737
),
38-
(np.array([1, 2], dtype="int64"), None, IntegerArray._from_sequence([1, 2]),),
38+
(np.array([1, 2], dtype="int64"), None, IntegerArray._from_sequence([1, 2])),
3939
# String alias passes through to NumPy
4040
([1, 2], "float32", PandasArray(np.array([1, 2], dtype="float32"))),
4141
# Period alias
@@ -120,10 +120,10 @@
120120
(pd.Series([1, 2]), None, PandasArray(np.array([1, 2], dtype=np.int64))),
121121
# String
122122
(["a", None], "string", StringArray._from_sequence(["a", None])),
123-
(["a", None], pd.StringDtype(), StringArray._from_sequence(["a", None]),),
123+
(["a", None], pd.StringDtype(), StringArray._from_sequence(["a", None])),
124124
# Boolean
125125
([True, None], "boolean", BooleanArray._from_sequence([True, None])),
126-
([True, None], pd.BooleanDtype(), BooleanArray._from_sequence([True, None]),),
126+
([True, None], pd.BooleanDtype(), BooleanArray._from_sequence([True, None])),
127127
# Index
128128
(pd.Index([1, 2]), None, PandasArray(np.array([1, 2], dtype=np.int64))),
129129
# Series[EA] returns the EA
@@ -174,7 +174,7 @@ def test_array_copy():
174174
period_array(["2000", "2001"], freq="D"),
175175
),
176176
# interval
177-
([pd.Interval(0, 1), pd.Interval(1, 2)], IntervalArray.from_breaks([0, 1, 2]),),
177+
([pd.Interval(0, 1), pd.Interval(1, 2)], IntervalArray.from_breaks([0, 1, 2])),
178178
# datetime
179179
(
180180
[pd.Timestamp("2000"), pd.Timestamp("2001")],

pandas/tests/arrays/test_timedeltas.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_incorrect_dtype_raises(self):
4646
TimedeltaArray(np.array([1, 2, 3], dtype="i8"), dtype="category")
4747

4848
with pytest.raises(
49-
ValueError, match=r"dtype int64 cannot be converted to timedelta64\[ns\]",
49+
ValueError, match=r"dtype int64 cannot be converted to timedelta64\[ns\]"
5050
):
5151
TimedeltaArray(np.array([1, 2, 3], dtype="i8"), dtype=np.dtype("int64"))
5252

pandas/tests/base/test_conversion.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def test_iter_box(self):
183183
PeriodArray,
184184
pd.core.dtypes.dtypes.PeriodDtype("A-DEC"),
185185
),
186-
(pd.IntervalIndex.from_breaks([0, 1, 2]), IntervalArray, "interval",),
186+
(pd.IntervalIndex.from_breaks([0, 1, 2]), IntervalArray, "interval"),
187187
# This test is currently failing for datetime64[ns] and timedelta64[ns].
188188
# The NumPy type system is sufficient for representing these types, so
189189
# we just use NumPy for Series / DataFrame columns of these types (so
@@ -285,10 +285,7 @@ def test_array_multiindex_raises():
285285
pd.core.arrays.period_array(["2000", "2001"], freq="D"),
286286
np.array([pd.Period("2000", freq="D"), pd.Period("2001", freq="D")]),
287287
),
288-
(
289-
pd.core.arrays.integer_array([0, np.nan]),
290-
np.array([0, pd.NA], dtype=object),
291-
),
288+
(pd.core.arrays.integer_array([0, np.nan]), np.array([0, pd.NA], dtype=object)),
292289
(
293290
IntervalArray.from_breaks([0, 1, 2]),
294291
np.array([pd.Interval(0, 1), pd.Interval(1, 2)], dtype=object),

pandas/tests/dtypes/test_missing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def test_array_equivalent(dtype_equal):
373373
)
374374
# The rest are not dtype_equal
375375
assert not array_equivalent(
376-
DatetimeIndex([0, np.nan]), DatetimeIndex([0, np.nan], tz="US/Eastern"),
376+
DatetimeIndex([0, np.nan]), DatetimeIndex([0, np.nan], tz="US/Eastern")
377377
)
378378
assert not array_equivalent(
379379
DatetimeIndex([0, np.nan], tz="CET"),

pandas/tests/extension/base/methods.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,14 @@ def test_argmin_argmax(self, data_for_sorting, data_missing_for_sorting, na_valu
9292
assert data_missing_for_sorting.argmax() == 0
9393
assert data_missing_for_sorting.argmin() == 2
9494

95-
@pytest.mark.parametrize(
96-
"method", ["argmax", "argmin"],
97-
)
95+
@pytest.mark.parametrize("method", ["argmax", "argmin"])
9896
def test_argmin_argmax_empty_array(self, method, data):
9997
# GH 24382
10098
err_msg = "attempt to get"
10199
with pytest.raises(ValueError, match=err_msg):
102100
getattr(data[:0], method)()
103101

104-
@pytest.mark.parametrize(
105-
"method", ["argmax", "argmin"],
106-
)
102+
@pytest.mark.parametrize("method", ["argmax", "argmin"])
107103
def test_argmin_argmax_all_na(self, method, data, na_value):
108104
# all missing with skipna=True is the same as emtpy
109105
err_msg = "attempt to get"

pandas/tests/extension/test_sparse.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,7 @@ def test_shift_0_periods(self, data):
316316
data._sparse_values[0] = data._sparse_values[1]
317317
assert result._sparse_values[0] != result._sparse_values[1]
318318

319-
@pytest.mark.parametrize(
320-
"method", ["argmax", "argmin"],
321-
)
319+
@pytest.mark.parametrize("method", ["argmax", "argmin"])
322320
def test_argmin_argmax_all_na(self, method, data, na_value):
323321
# overriding because Sparse[int64, 0] cannot handle na_value
324322
self._check_unsupported(data)

pandas/tests/frame/indexing/test_setitem.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def test_setitem_timestamp_empty_columns(self):
108108
df["now"] = Timestamp("20130101", tz="UTC")
109109

110110
expected = DataFrame(
111-
[[Timestamp("20130101", tz="UTC")]] * 3, index=[0, 1, 2], columns=["now"],
111+
[[Timestamp("20130101", tz="UTC")]] * 3, index=[0, 1, 2], columns=["now"]
112112
)
113113
tm.assert_frame_equal(df, expected)
114114

@@ -158,11 +158,7 @@ def test_setitem_dict_preserves_dtypes(self):
158158
}
159159
)
160160
for idx, b in enumerate([1, 2, 3]):
161-
df.loc[df.shape[0]] = {
162-
"a": int(idx),
163-
"b": float(b),
164-
"c": float(b),
165-
}
161+
df.loc[df.shape[0]] = {"a": int(idx), "b": float(b), "c": float(b)}
166162
tm.assert_frame_equal(df, expected)
167163

168164
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)