Skip to content

Commit 3b4c786

Browse files
removed some redundancy in the test case
1 parent 46cc883 commit 3b4c786

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pandas/tests/indexing/test_na_indexing.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from contextlib import nullcontext as do_not_raise
2+
13
import pytest
24

35
import pandas as pd
@@ -52,10 +54,11 @@ def test_series_mask_boolean(values, dtype, mask, indexer_class, frame):
5254

5355
if indexer_class is pd.Series:
5456
msg = "iLocation based boolean indexing cannot use an indexable as a mask"
55-
with pytest.raises(ValueError, match=msg):
56-
result = obj.iloc[mask]
57-
tm.assert_equal(result, expected)
57+
expectation = pytest.raises(ValueError, match=msg)
5858
else:
59+
expectation = do_not_raise()
60+
61+
with expectation:
5962
result = obj.iloc[mask]
6063
tm.assert_equal(result, expected)
6164

0 commit comments

Comments
 (0)