test_validate.py 731 B

12345678910111213141516171819
  1. import pytest
  2. class TestSeriesValidate(object):
  3. """Tests for error handling related to data types of method arguments."""
  4. @pytest.mark.parametrize("func", ["reset_index", "_set_name",
  5. "sort_values", "sort_index",
  6. "rename", "dropna"])
  7. @pytest.mark.parametrize("inplace", [1, "True", [1, 2, 3], 5.0])
  8. def test_validate_bool_args(self, string_series, func, inplace):
  9. msg = "For argument \"inplace\" expected type bool"
  10. kwargs = dict(inplace=inplace)
  11. if func == "_set_name":
  12. kwargs["name"] = "hello"
  13. with pytest.raises(ValueError, match=msg):
  14. getattr(string_series, func)(**kwargs)