Skip to content

Commit 86280fe

Browse files
committed
TST: Add tests for Index.putmask with an invalid mask
1 parent 2243252 commit 86280fe

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pandas/tests/indexes/common.py

+13
Original file line numberDiff line numberDiff line change
@@ -996,3 +996,16 @@ def test_searchsorted_monotonic(self, indices):
996996
# non-monotonic should raise.
997997
with pytest.raises(ValueError):
998998
indices._searchsorted_monotonic(value, side='left')
999+
1000+
def test_putmask_with_wrong_mask(self):
1001+
# GH18368
1002+
index = self.create_index()
1003+
1004+
with pytest.raises(ValueError):
1005+
index.putmask(np.ones(len(index) + 1, np.bool), 1)
1006+
1007+
with pytest.raises(ValueError):
1008+
index.putmask(np.ones(len(index) - 1, np.bool), 1)
1009+
1010+
with pytest.raises(ValueError):
1011+
index.putmask('foo', 1)

0 commit comments

Comments
 (0)