Skip to content

Commit dfdddfa

Browse files
committed
TST: Parametrize test using functions pandas-dev#31746
1 parent 70ef8e2 commit dfdddfa

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pandas/tests/series/test_reductions.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@
99
import pandas._testing as tm
1010

1111

12-
def test_reductions_series_strings():
12+
@pytest.mark.parametrize("operation", ["min", "max"])
13+
def test_reductions_series_strings(operation):
1314
# GH#31746
14-
ser = Series(["a", "b"], dtype="string")
15-
assert ser.max() == "b"
16-
assert ser.min() == "a"
15+
list_str = ["a", "b"]
16+
ser = Series(list_str, dtype="string")
17+
res_operation_serie = getattr(ser, operation)()
18+
func_builtin_python = __builtins__[operation]
19+
res_builtin_python = func_builtin_python(list_str)
20+
assert res_operation_serie == res_builtin_python
1721

1822

1923
@pytest.mark.parametrize("as_period", [True, False])

0 commit comments

Comments
 (0)