Skip to content

Commit

Permalink
TST: Add test for clip-na (pandas-dev#16369)
Browse files Browse the repository at this point in the history
Additional test cases for pandas-dev#16364
when upper and / or lower is nan.
  • Loading branch information
TomAugspurger authored and stangirala committed Jun 11, 2017
1 parent 9328ab7 commit 15f33e0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pandas/tests/frame/test_analytics.py
Expand Up @@ -1863,6 +1863,23 @@ def test_clip_against_frame(self):
tm.assert_frame_equal(clipped_df[ub_mask], ub[ub_mask])
tm.assert_frame_equal(clipped_df[mask], df[mask])

def test_clip_na(self):
msg = "Cannot use an NA"
with tm.assert_raises_regex(ValueError, msg):
self.frame.clip(lower=np.nan)

with tm.assert_raises_regex(ValueError, msg):
self.frame.clip(lower=[np.nan])

with tm.assert_raises_regex(ValueError, msg):
self.frame.clip(upper=np.nan)

with tm.assert_raises_regex(ValueError, msg):
self.frame.clip(upper=[np.nan])

with tm.assert_raises_regex(ValueError, msg):
self.frame.clip(lower=np.nan, upper=np.nan)

# Matrix-like

def test_dot(self):
Expand Down

0 comments on commit 15f33e0

Please sign in to comment.