From a8003e9a644fb8e542ca8955f3d02a43f2d52e7b Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Fri, 17 Jan 2020 02:23:11 +0200 Subject: [PATCH 1/3] TST: fix failing tests --- pandas/tests/arrays/categorical/test_algos.py | 2 +- pandas/tests/indexes/multi/test_analytics.py | 2 +- pandas/tests/indexes/period/test_indexing.py | 2 +- pandas/tests/series/indexing/test_indexing.py | 2 +- pandas/tests/test_take.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pandas/tests/arrays/categorical/test_algos.py b/pandas/tests/arrays/categorical/test_algos.py index 52640044565fc..bac05e0996caf 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..be832a65c5624 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..a2dffeddf8592 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..ffee532fb5adc 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..9ebcaac4a7821 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) From 2fc95054636505da04f961d09c38b14ebbd4aeee Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Fri, 17 Jan 2020 02:44:54 +0200 Subject: [PATCH 2/3] using regex --- pandas/tests/arrays/categorical/test_algos.py | 2 +- pandas/tests/indexes/multi/test_analytics.py | 2 +- pandas/tests/indexes/period/test_indexing.py | 2 +- pandas/tests/series/indexing/test_indexing.py | 2 +- pandas/tests/test_take.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pandas/tests/arrays/categorical/test_algos.py b/pandas/tests/arrays/categorical/test_algos.py index bac05e0996caf..d8004aa21c2a2 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 axis 0 with 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 be832a65c5624..c6bed2ad2639d 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 axis 0 with 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 a2dffeddf8592..83a368cd82ba3 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 axis 0 with 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 ffee532fb5adc..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 axis 0 with 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 9ebcaac4a7821..98447e257be44 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 axis 0 with 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) From 8ede86c76559da71f041b7afc2abb81f33aef07b Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Fri, 17 Jan 2020 03:05:26 +0200 Subject: [PATCH 3/3] Fix spaces --- pandas/tests/arrays/categorical/test_algos.py | 2 +- pandas/tests/indexes/multi/test_analytics.py | 2 +- pandas/tests/indexes/period/test_indexing.py | 2 +- pandas/tests/test_take.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/tests/arrays/categorical/test_algos.py b/pandas/tests/arrays/categorical/test_algos.py index d8004aa21c2a2..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( axis 0 with |) 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 c6bed2ad2639d..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( axis 0 with |) 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 83a368cd82ba3..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( axis 0 with |) 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/test_take.py b/pandas/tests/test_take.py index 98447e257be44..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(axis 0 with|) 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)