Skip to content

Commit 00b5cc5

Browse files
authored
TST: Use more index_or_series (pandas-dev#48927)
1 parent 053305f commit 00b5cc5

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

pandas/tests/reductions/test_reductions.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -924,10 +924,9 @@ def test_all_any(self):
924924
s = Series(["abc", True])
925925
assert s.any()
926926

927-
@pytest.mark.parametrize("klass", [Index, Series])
928-
def test_numpy_all_any(self, klass):
927+
def test_numpy_all_any(self, index_or_series):
929928
# GH#40180
930-
idx = klass([0, 1, 2])
929+
idx = index_or_series([0, 1, 2])
931930
assert not np.all(idx)
932931
assert np.any(idx)
933932
idx = Index([1, 2, 3])

pandas/tests/reshape/concat/test_append_common.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,10 @@ def _check_expected_dtype(self, obj, label):
7070
else:
7171
raise ValueError
7272

73-
@pytest.mark.parametrize("box", [Index, Series])
74-
def test_dtypes(self, item, box):
73+
def test_dtypes(self, item, index_or_series):
7574
# to confirm test case covers intended dtypes
7675
typ, vals = item
77-
obj = box(vals)
76+
obj = index_or_series(vals)
7877
if isinstance(obj, Index):
7978
assert obj.dtype == typ
8079
elif isinstance(obj, Series):

pandas/tests/tools/test_to_datetime.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ def test_to_datetime_readonly(self, readonly):
6767
expected = to_datetime([])
6868
tm.assert_index_equal(result, expected)
6969

70-
@pytest.mark.parametrize("box", [Series, Index])
7170
@pytest.mark.parametrize(
7271
"format, expected",
7372
[
@@ -81,10 +80,10 @@ def test_to_datetime_readonly(self, readonly):
8180
],
8281
],
8382
)
84-
def test_to_datetime_format(self, cache, box, format, expected):
85-
values = box(["1/1/2000", "1/2/2000", "1/3/2000"])
83+
def test_to_datetime_format(self, cache, index_or_series, format, expected):
84+
values = index_or_series(["1/1/2000", "1/2/2000", "1/3/2000"])
8685
result = to_datetime(values, format=format, cache=cache)
87-
expected = box(expected)
86+
expected = index_or_series(expected)
8887
if isinstance(expected, Series):
8988
tm.assert_series_equal(result, expected)
9089
else:

0 commit comments

Comments
 (0)