Skip to content

Commit 6b05e16

Browse files
TomAugspurgerpcluo
authored andcommitted
TST: Add test for clip-na (pandas-dev#16369)
Additional test cases for pandas-dev#16364 when upper and / or lower is nan.
1 parent 08f82a1 commit 6b05e16

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pandas/tests/frame/test_analytics.py

+17
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,23 @@ def test_clip_against_frame(self):
18631863
tm.assert_frame_equal(clipped_df[ub_mask], ub[ub_mask])
18641864
tm.assert_frame_equal(clipped_df[mask], df[mask])
18651865

1866+
def test_clip_na(self):
1867+
msg = "Cannot use an NA"
1868+
with tm.assert_raises_regex(ValueError, msg):
1869+
self.frame.clip(lower=np.nan)
1870+
1871+
with tm.assert_raises_regex(ValueError, msg):
1872+
self.frame.clip(lower=[np.nan])
1873+
1874+
with tm.assert_raises_regex(ValueError, msg):
1875+
self.frame.clip(upper=np.nan)
1876+
1877+
with tm.assert_raises_regex(ValueError, msg):
1878+
self.frame.clip(upper=[np.nan])
1879+
1880+
with tm.assert_raises_regex(ValueError, msg):
1881+
self.frame.clip(lower=np.nan, upper=np.nan)
1882+
18661883
# Matrix-like
18671884

18681885
def test_dot(self):

0 commit comments

Comments
 (0)