Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions pandas/tests/arrays/boolean/test_logical.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,20 @@ def test_eq_mismatched_type(self, other):
expected = pd.array([True, True])
tm.assert_extension_array_equal(result, expected)

def test_logical_length_mismatch_raises(self, all_logical_operators):
@pytest.mark.parametrize("other", [[True, False], [True, False, True, False]])
def test_logical_length_mismatch_raises(self, other, all_logical_operators):
op_name = all_logical_operators
a = pd.array([True, False, None], dtype="boolean")
msg = "Lengths must match"

with pytest.raises(ValueError, match=msg):
getattr(a, op_name)([True, False])
getattr(a, op_name)(other)

with pytest.raises(ValueError, match=msg):
getattr(a, op_name)(np.array([True, False]))
getattr(a, op_name)(np.array(other))

with pytest.raises(ValueError, match=msg):
getattr(a, op_name)(pd.array([True, False], dtype="boolean"))
getattr(a, op_name)(pd.array(other, dtype="boolean"))

def test_logical_nan_raises(self, all_logical_operators):
op_name = all_logical_operators
Expand Down