Skip to content

Commit 016482a

Browse files
Turned class based tests into function based tests (#32184)
1 parent b2ebd5a commit 016482a

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

pandas/tests/series/test_validate.py

+12-14
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
import pytest
22

33

4-
class TestSeriesValidate:
4+
@pytest.mark.parametrize(
5+
"func",
6+
["reset_index", "_set_name", "sort_values", "sort_index", "rename", "dropna"],
7+
)
8+
@pytest.mark.parametrize("inplace", [1, "True", [1, 2, 3], 5.0])
9+
def test_validate_bool_args(string_series, func, inplace):
510
"""Tests for error handling related to data types of method arguments."""
11+
msg = 'For argument "inplace" expected type bool'
12+
kwargs = dict(inplace=inplace)
613

7-
@pytest.mark.parametrize(
8-
"func",
9-
["reset_index", "_set_name", "sort_values", "sort_index", "rename", "dropna"],
10-
)
11-
@pytest.mark.parametrize("inplace", [1, "True", [1, 2, 3], 5.0])
12-
def test_validate_bool_args(self, string_series, func, inplace):
13-
msg = 'For argument "inplace" expected type bool'
14-
kwargs = dict(inplace=inplace)
14+
if func == "_set_name":
15+
kwargs["name"] = "hello"
1516

16-
if func == "_set_name":
17-
kwargs["name"] = "hello"
18-
19-
with pytest.raises(ValueError, match=msg):
20-
getattr(string_series, func)(**kwargs)
17+
with pytest.raises(ValueError, match=msg):
18+
getattr(string_series, func)(**kwargs)

0 commit comments

Comments
 (0)