Skip to content

Commit 86c2733

Browse files
committed
TST: test for #21982
1 parent 3c07893 commit 86c2733

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/tests/indexing/test_iloc.py

+12
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ def test_iloc_getitem_neg_int(self):
126126
typs=['labels', 'mixed', 'ts', 'floats', 'empty'],
127127
fails=IndexError)
128128

129+
@pytest.mark.parametrize('dims', [1, 2])
130+
def test_iloc_getitem_invalid_scalar(self, dims):
131+
# GH 21982
132+
133+
if dims == 1:
134+
s = Series(np.arange(10))
135+
else:
136+
s = DataFrame(np.arange(100).reshape(10, 10))
137+
138+
tm.assert_raises_regex(TypeError, 'Cannot index by location index',
139+
lambda : s.iloc['a'])
140+
129141
def test_iloc_array_not_mutating_negative_indices(self):
130142

131143
# GH 21867

0 commit comments

Comments
 (0)