Skip to content

Commit

Permalink
TST: Add tests for Index.putmask with an invalid mask
Browse files Browse the repository at this point in the history
  • Loading branch information
Licht-T committed Nov 25, 2017
1 parent 2243252 commit 86280fe
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pandas/tests/indexes/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,3 +996,16 @@ def test_searchsorted_monotonic(self, indices):
# non-monotonic should raise.
with pytest.raises(ValueError):
indices._searchsorted_monotonic(value, side='left')

def test_putmask_with_wrong_mask(self):
# GH18368
index = self.create_index()

with pytest.raises(ValueError):
index.putmask(np.ones(len(index) + 1, np.bool), 1)

with pytest.raises(ValueError):
index.putmask(np.ones(len(index) - 1, np.bool), 1)

with pytest.raises(ValueError):
index.putmask('foo', 1)

0 comments on commit 86280fe

Please sign in to comment.