Skip to content

Avoid bare pytest.raises in indexes/categorical/test_indexing.py #32797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6 changes: 4 additions & 2 deletions pandas/tests/indexes/categorical/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def test_take_fill_value(self):
with pytest.raises(ValueError, match=msg):
idx.take(np.array([1, 0, -5]), fill_value=True)

with pytest.raises(IndexError):
msg = "index -5 is out of bounds for (axis 0 with )?size 3"
with pytest.raises(IndexError, match=msg):
idx.take(np.array([1, -5]))

def test_take_fill_value_datetime(self):
Expand Down Expand Up @@ -104,7 +105,8 @@ def test_take_fill_value_datetime(self):
with pytest.raises(ValueError, match=msg):
idx.take(np.array([1, 0, -5]), fill_value=True)

with pytest.raises(IndexError):
msg = "index -5 is out of bounds for (axis 0 with )?size 3"
with pytest.raises(IndexError, match=msg):
idx.take(np.array([1, -5]))

def test_take_invalid_kwargs(self):
Expand Down