Skip to content

Commit bd84cd5

Browse files
committed
add Series/DF logical operations nan propagation tests
1 parent 0de9955 commit bd84cd5

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

pandas/tests/frame/test_operators.py

+14
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,20 @@ def test_logical_with_nas(self):
218218
expected = Series([True, True])
219219
tm.assert_series_equal(result, expected)
220220

221+
@pytest.mark.parametrize(
222+
"A, B, C",
223+
[
224+
([True, False, np.nan], [True, False, True], [True, False, False]),
225+
([True, False, True], [True, False, np.nan], [True, False, True]),
226+
],
227+
)
228+
def test_logical_operators_nans(self, A, B, C):
229+
# GH 13896
230+
result = DataFrame(A) | DataFrame(B)
231+
expected = DataFrame(C)
232+
233+
tm.assert_frame_equal(result, expected)
234+
221235

222236
class TestDataFrameOperators:
223237
@pytest.mark.parametrize(

pandas/tests/series/test_operators.py

+14
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,20 @@ def test_logical_operators_bool_dtype_with_empty(self):
4343
expected = s_tft
4444
tm.assert_series_equal(res, expected)
4545

46+
@pytest.mark.parametrize(
47+
"A, B, C",
48+
[
49+
([True, False, np.nan], [True, False, True], [True, False, False]),
50+
([True, False, True], [True, False, np.nan], [True, False, True]),
51+
],
52+
)
53+
def test_logical_operators_nans(self, A, B, C):
54+
# GH 13896
55+
result = Series(A) | Series(B)
56+
expected = Series(C)
57+
58+
tm.assert_series_equal(result, expected)
59+
4660
def test_logical_operators_int_dtype_with_int_dtype(self):
4761
# GH#9016: support bitwise op for integer types
4862

0 commit comments

Comments
 (0)