|
1 | 1 | import pytest
|
2 | 2 |
|
3 | 3 |
|
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): |
5 | 10 | """Tests for error handling related to data types of method arguments."""
|
| 11 | + msg = 'For argument "inplace" expected type bool' |
| 12 | + kwargs = dict(inplace=inplace) |
6 | 13 |
|
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" |
15 | 16 |
|
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