@@ -80,33 +80,18 @@ def test_getitem_ndarray_3d(self, index, obj, idxr, idxr_id):
8080 idxr = idxr (obj )
8181 nd3 = np .random .randint (5 , size = (2 , 2 , 2 ))
8282
83- msg = (
84- r"Buffer has wrong number of dimensions \(expected 1, "
85- r"got 3\)|"
86- "Cannot index with multidimensional key|"
87- r"Wrong number of dimensions. values.ndim != ndim \[3 != 1\]|"
88- "Index data must be 1-dimensional"
83+ msg = "|" .join (
84+ [
85+ r"Buffer has wrong number of dimensions \(expected 1, got 3\)" ,
86+ "Cannot index with multidimensional key" ,
87+ r"Wrong number of dimensions. values.ndim != ndim \[3 != 1\]" ,
88+ "Index data must be 1-dimensional" ,
89+ ]
8990 )
9091
91- if (
92- isinstance (obj , Series )
93- and idxr_id == "getitem"
94- and index .inferred_type
95- in [
96- "string" ,
97- "datetime64" ,
98- "period" ,
99- "timedelta64" ,
100- "boolean" ,
101- "categorical" ,
102- ]
103- ):
92+ with pytest .raises (ValueError , match = msg ):
10493 with tm .assert_produces_warning (DeprecationWarning , check_stacklevel = False ):
10594 idxr [nd3 ]
106- else :
107- with pytest .raises (ValueError , match = msg ):
108- with tm .assert_produces_warning (DeprecationWarning ):
109- idxr [nd3 ]
11095
11196 @pytest .mark .parametrize (
11297 "index" , tm .all_index_generator (5 ), ids = lambda x : type (x ).__name__
0 commit comments