diff --git a/pandas/tests/arrays/categorical/test_algos.py b/pandas/tests/arrays/categorical/test_algos.py index 52640044565fc..07abdceb71f9f 100644 --- a/pandas/tests/arrays/categorical/test_algos.py +++ b/pandas/tests/arrays/categorical/test_algos.py @@ -111,7 +111,7 @@ def test_take_bounds(self, allow_fill): if allow_fill: msg = "indices are out-of-bounds" else: - msg = "index 4 is out of bounds for size 3" + msg = "index 4 is out of bounds for( axis 0 with|) size 3" with pytest.raises(IndexError, match=msg): cat.take([4, 5], allow_fill=allow_fill) diff --git a/pandas/tests/indexes/multi/test_analytics.py b/pandas/tests/indexes/multi/test_analytics.py index 209cc627aba8b..5d441b0fa8091 100644 --- a/pandas/tests/indexes/multi/test_analytics.py +++ b/pandas/tests/indexes/multi/test_analytics.py @@ -218,7 +218,7 @@ def test_take_fill_value(): with pytest.raises(ValueError, match=msg): idx.take(np.array([1, 0, -5]), fill_value=True) - msg = "index -5 is out of bounds for size 4" + msg = "index -5 is out of bounds for( axis 0 with|) size 4" with pytest.raises(IndexError, match=msg): idx.take(np.array([1, -5])) diff --git a/pandas/tests/indexes/period/test_indexing.py b/pandas/tests/indexes/period/test_indexing.py index 592dccc5fc8ed..900b1cc91d905 100644 --- a/pandas/tests/indexes/period/test_indexing.py +++ b/pandas/tests/indexes/period/test_indexing.py @@ -357,7 +357,7 @@ def test_take_fill_value(self): with pytest.raises(ValueError, match=msg): idx.take(np.array([1, 0, -5]), fill_value=True) - msg = "index -5 is out of bounds for size 3" + 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])) diff --git a/pandas/tests/series/indexing/test_indexing.py b/pandas/tests/series/indexing/test_indexing.py index d552ce739d91c..4bc5bb90f2cb7 100644 --- a/pandas/tests/series/indexing/test_indexing.py +++ b/pandas/tests/series/indexing/test_indexing.py @@ -894,7 +894,7 @@ def test_take(): expected = Series([4, 2, 4], index=[4, 3, 4]) tm.assert_series_equal(actual, expected) - msg = "index {} is out of bounds for size 5" + msg = "index {} is out of bounds for( axis 0 with|) size 5" with pytest.raises(IndexError, match=msg.format(10)): s.take([1, 10]) with pytest.raises(IndexError, match=msg.format(5)): diff --git a/pandas/tests/test_take.py b/pandas/tests/test_take.py index 1cd5f11057464..d7c6496e0ae5b 100644 --- a/pandas/tests/test_take.py +++ b/pandas/tests/test_take.py @@ -428,7 +428,7 @@ def test_bounds_check_large(self): with pytest.raises(IndexError, match=msg): algos.take(arr, [2, 3], allow_fill=True) - msg = "index 2 is out of bounds for size 2" + msg = "index 2 is out of bounds for( axis 0 with|) size 2" with pytest.raises(IndexError, match=msg): algos.take(arr, [2, 3], allow_fill=False)