From b63fc176f38fc10b3d56b63025209763153fc09f Mon Sep 17 00:00:00 2001 From: Boris Rumyantsev Date: Sun, 24 Oct 2021 18:28:25 +0300 Subject: [PATCH] TST: Adding test to series\indexing\test_indexing (pandas-dev#18579) --- pandas/tests/series/indexing/test_indexing.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pandas/tests/series/indexing/test_indexing.py b/pandas/tests/series/indexing/test_indexing.py index 6c3587c7eeada..d77f831bee8bc 100644 --- a/pandas/tests/series/indexing/test_indexing.py +++ b/pandas/tests/series/indexing/test_indexing.py @@ -377,3 +377,17 @@ def test_frozenset_index(): assert s[idx1] == 2 s[idx1] = 3 assert s[idx1] == 3 + + +def test_boolean_index(): + # GH18579 + s1 = Series([1, 2, 3], index=[4, 5, 6]) + s2 = Series([1, 3, 2], index=s1 == 2) + tm.assert_series_equal(Series([1, 3, 2], [False, True, False]), s2) + + +def test_index_ndim_gt_1_raises(): + # GH18579 + df = DataFrame([[1, 2], [3, 4], [5, 6]], index=[3, 6, 9]) + with pytest.raises(ValueError, match="Index data must be 1-dimensional"): + Series([1, 3, 2], index=df)