Skip to content

Commit 6b2a860

Browse files
Comma cleanup (#36082)
1 parent cab3e0e commit 6b2a860

12 files changed

+27
-43
lines changed

pandas/tests/indexes/datetimes/test_datetime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_reindex_with_same_tz(self):
5151
"2010-01-02 00:00:00",
5252
]
5353
expected1 = DatetimeIndex(
54-
expected_list1, dtype="datetime64[ns, UTC]", freq=None,
54+
expected_list1, dtype="datetime64[ns, UTC]", freq=None
5555
)
5656
expected2 = np.array([0] + [-1] * 21 + [23], dtype=np.dtype("intp"))
5757
tm.assert_index_equal(result1, expected1)

pandas/tests/indexes/datetimes/test_timezones.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ def test_dti_from_tzaware_datetime(self, tz):
799799

800800
@pytest.mark.parametrize("tzstr", ["US/Eastern", "dateutil/US/Eastern"])
801801
def test_dti_tz_constructors(self, tzstr):
802-
""" Test different DatetimeIndex constructions with timezone
802+
"""Test different DatetimeIndex constructions with timezone
803803
Follow-up of GH#4229
804804
"""
805805
arr = ["11/10/2005 08:00:00", "11/10/2005 09:00:00"]

pandas/tests/indexes/multi/test_constructors.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,18 +741,18 @@ def test_raise_invalid_sortorder():
741741

742742
with pytest.raises(ValueError, match=r".* sortorder 2 with lexsort_depth 1.*"):
743743
MultiIndex(
744-
levels=levels, codes=[[0, 0, 0, 1, 1, 1], [0, 1, 2, 0, 2, 1]], sortorder=2,
744+
levels=levels, codes=[[0, 0, 0, 1, 1, 1], [0, 1, 2, 0, 2, 1]], sortorder=2
745745
)
746746

747747
with pytest.raises(ValueError, match=r".* sortorder 1 with lexsort_depth 0.*"):
748748
MultiIndex(
749-
levels=levels, codes=[[0, 0, 1, 0, 1, 1], [0, 1, 0, 2, 2, 1]], sortorder=1,
749+
levels=levels, codes=[[0, 0, 1, 0, 1, 1], [0, 1, 0, 2, 2, 1]], sortorder=1
750750
)
751751

752752

753753
def test_datetimeindex():
754754
idx1 = pd.DatetimeIndex(
755-
["2013-04-01 9:00", "2013-04-02 9:00", "2013-04-03 9:00"] * 2, tz="Asia/Tokyo",
755+
["2013-04-01 9:00", "2013-04-02 9:00", "2013-04-03 9:00"] * 2, tz="Asia/Tokyo"
756756
)
757757
idx2 = pd.date_range("2010/01/01", periods=6, freq="M", tz="US/Eastern")
758758
idx = MultiIndex.from_arrays([idx1, idx2])

pandas/tests/indexes/multi/test_isin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def test_isin_level_kwarg():
7878
@pytest.mark.parametrize(
7979
"labels,expected,level",
8080
[
81-
([("b", np.nan)], np.array([False, False, True]), None,),
81+
([("b", np.nan)], np.array([False, False, True]), None),
8282
([np.nan, "a"], np.array([True, True, False]), 0),
8383
(["d", np.nan], np.array([False, True, True]), 1),
8484
],

pandas/tests/indexes/test_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2426,7 +2426,7 @@ def test_index_with_tuple_bool(self):
24262426
# TODO: remove tupleize_cols=False once correct behaviour is restored
24272427
# TODO: also this op right now produces FutureWarning from numpy
24282428
idx = Index([("a", "b"), ("b", "c"), ("c", "a")], tupleize_cols=False)
2429-
result = idx == ("c", "a",)
2429+
result = idx == ("c", "a")
24302430
expected = np.array([False, False, True])
24312431
tm.assert_numpy_array_equal(result, expected)
24322432

pandas/tests/indexes/timedeltas/test_scalar_compat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,18 @@ def test_round(self):
104104
"L",
105105
t1a,
106106
TimedeltaIndex(
107-
["-1 days +00:00:00", "-2 days +23:58:58", "-2 days +23:57:56"],
107+
["-1 days +00:00:00", "-2 days +23:58:58", "-2 days +23:57:56"]
108108
),
109109
),
110110
(
111111
"S",
112112
t1a,
113113
TimedeltaIndex(
114-
["-1 days +00:00:00", "-2 days +23:58:58", "-2 days +23:57:56"],
114+
["-1 days +00:00:00", "-2 days +23:58:58", "-2 days +23:57:56"]
115115
),
116116
),
117-
("12T", t1c, TimedeltaIndex(["-1 days", "-1 days", "-1 days"],),),
118-
("H", t1c, TimedeltaIndex(["-1 days", "-1 days", "-1 days"],),),
117+
("12T", t1c, TimedeltaIndex(["-1 days", "-1 days", "-1 days"])),
118+
("H", t1c, TimedeltaIndex(["-1 days", "-1 days", "-1 days"])),
119119
("d", t1c, TimedeltaIndex([-1, -1, -1], unit="D")),
120120
]:
121121

pandas/tests/indexes/timedeltas/test_searchsorted.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_searchsorted_different_argument_classes(self, klass):
1717
tm.assert_numpy_array_equal(result, expected)
1818

1919
@pytest.mark.parametrize(
20-
"arg", [[1, 2], ["a", "b"], [Timestamp("2020-01-01", tz="Europe/London")] * 2],
20+
"arg", [[1, 2], ["a", "b"], [Timestamp("2020-01-01", tz="Europe/London")] * 2]
2121
)
2222
def test_searchsorted_invalid_argument_dtype(self, arg):
2323
idx = TimedeltaIndex(["1 day", "2 days", "3 days"])

pandas/tests/indexing/common.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,7 @@ def check_values(self, f, func, values=False):
144144

145145
tm.assert_almost_equal(result, expected)
146146

147-
def check_result(
148-
self, method, key, typs=None, axes=None, fails=None,
149-
):
147+
def check_result(self, method, key, typs=None, axes=None, fails=None):
150148
def _eq(axis, obj, key):
151149
""" compare equal for these 2 keys """
152150
axified = _axify(obj, key, axis)

pandas/tests/indexing/test_callable.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,11 @@ def test_frame_loc_callable(self):
1717
res = df.loc[lambda x: x.A > 2]
1818
tm.assert_frame_equal(res, df.loc[df.A > 2])
1919

20-
res = df.loc[
21-
lambda x: x.A > 2,
22-
] # noqa: E231
23-
tm.assert_frame_equal(res, df.loc[df.A > 2,]) # noqa: E231
20+
res = df.loc[lambda x: x.A > 2] # noqa: E231
21+
tm.assert_frame_equal(res, df.loc[df.A > 2]) # noqa: E231
2422

25-
res = df.loc[
26-
lambda x: x.A > 2,
27-
] # noqa: E231
28-
tm.assert_frame_equal(res, df.loc[df.A > 2,]) # noqa: E231
23+
res = df.loc[lambda x: x.A > 2] # noqa: E231
24+
tm.assert_frame_equal(res, df.loc[df.A > 2]) # noqa: E231
2925

3026
res = df.loc[lambda x: x.B == "b", :]
3127
tm.assert_frame_equal(res, df.loc[df.B == "b", :])
@@ -94,10 +90,8 @@ def test_frame_loc_callable_labels(self):
9490
res = df.loc[lambda x: ["A", "C"]]
9591
tm.assert_frame_equal(res, df.loc[["A", "C"]])
9692

97-
res = df.loc[
98-
lambda x: ["A", "C"],
99-
] # noqa: E231
100-
tm.assert_frame_equal(res, df.loc[["A", "C"],]) # noqa: E231
93+
res = df.loc[lambda x: ["A", "C"]] # noqa: E231
94+
tm.assert_frame_equal(res, df.loc[["A", "C"]]) # noqa: E231
10195

10296
res = df.loc[lambda x: ["A", "C"], :]
10397
tm.assert_frame_equal(res, df.loc[["A", "C"], :])

pandas/tests/indexing/test_check_indexer.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_valid_input(indexer, expected):
3232

3333

3434
@pytest.mark.parametrize(
35-
"indexer", [[True, False, None], pd.array([True, False, None], dtype="boolean")],
35+
"indexer", [[True, False, None], pd.array([True, False, None], dtype="boolean")]
3636
)
3737
def test_boolean_na_returns_indexer(indexer):
3838
# https://github.com/pandas-dev/pandas/issues/31503
@@ -61,7 +61,7 @@ def test_bool_raise_length(indexer):
6161

6262

6363
@pytest.mark.parametrize(
64-
"indexer", [[0, 1, None], pd.array([0, 1, pd.NA], dtype="Int64")],
64+
"indexer", [[0, 1, None], pd.array([0, 1, pd.NA], dtype="Int64")]
6565
)
6666
def test_int_raise_missing_values(indexer):
6767
array = np.array([1, 2, 3])
@@ -89,9 +89,7 @@ def test_raise_invalid_array_dtypes(indexer):
8989
check_array_indexer(array, indexer)
9090

9191

92-
@pytest.mark.parametrize(
93-
"indexer", [None, Ellipsis, slice(0, 3), (None,)],
94-
)
92+
@pytest.mark.parametrize("indexer", [None, Ellipsis, slice(0, 3), (None,)])
9593
def test_pass_through_non_array_likes(indexer):
9694
array = np.array([1, 2, 3])
9795

pandas/tests/indexing/test_coercion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def _assert_setitem_series_conversion(
8787
# tm.assert_series_equal(temp, expected_series)
8888

8989
@pytest.mark.parametrize(
90-
"val,exp_dtype", [(1, object), (1.1, object), (1 + 1j, object), (True, object)],
90+
"val,exp_dtype", [(1, object), (1.1, object), (1 + 1j, object), (True, object)]
9191
)
9292
def test_setitem_series_object(self, val, exp_dtype):
9393
obj = pd.Series(list("abcd"))

pandas/tests/indexing/test_floats.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,7 @@ def test_scalar_with_mixed(self):
181181
expected = 3
182182
assert result == expected
183183

184-
@pytest.mark.parametrize(
185-
"index_func", [tm.makeIntIndex, tm.makeRangeIndex],
186-
)
184+
@pytest.mark.parametrize("index_func", [tm.makeIntIndex, tm.makeRangeIndex])
187185
@pytest.mark.parametrize("klass", [Series, DataFrame])
188186
def test_scalar_integer(self, index_func, klass):
189187

@@ -405,7 +403,7 @@ def test_slice_integer(self):
405403

406404
@pytest.mark.parametrize("l", [slice(2, 4.0), slice(2.0, 4), slice(2.0, 4.0)])
407405
def test_integer_positional_indexing(self, l):
408-
""" make sure that we are raising on positional indexing
406+
"""make sure that we are raising on positional indexing
409407
w.r.t. an integer index
410408
"""
411409
s = Series(range(2, 6), index=range(2, 6))
@@ -425,9 +423,7 @@ def test_integer_positional_indexing(self, l):
425423
with pytest.raises(TypeError, match=msg):
426424
s.iloc[l]
427425

428-
@pytest.mark.parametrize(
429-
"index_func", [tm.makeIntIndex, tm.makeRangeIndex],
430-
)
426+
@pytest.mark.parametrize("index_func", [tm.makeIntIndex, tm.makeRangeIndex])
431427
def test_slice_integer_frame_getitem(self, index_func):
432428

433429
# similar to above, but on the getitem dim (of a DataFrame)
@@ -486,9 +482,7 @@ def test_slice_integer_frame_getitem(self, index_func):
486482
s[l]
487483

488484
@pytest.mark.parametrize("l", [slice(3.0, 4), slice(3, 4.0), slice(3.0, 4.0)])
489-
@pytest.mark.parametrize(
490-
"index_func", [tm.makeIntIndex, tm.makeRangeIndex],
491-
)
485+
@pytest.mark.parametrize("index_func", [tm.makeIntIndex, tm.makeRangeIndex])
492486
def test_float_slice_getitem_with_integer_index_raises(self, l, index_func):
493487

494488
# similar to above, but on the getitem dim (of a DataFrame)

0 commit comments

Comments
 (0)