diff --git a/pandas/tests/frame/test_analytics.py b/pandas/tests/frame/test_analytics.py index be89b27912d1c..1b6471fcef565 100644 --- a/pandas/tests/frame/test_analytics.py +++ b/pandas/tests/frame/test_analytics.py @@ -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):