Skip to content

Commit 4f1052e

Browse files
authored
TST: Update BooleanArray _logical_method test to fail on incorrect length comparison operator (pandas-dev#59708)
Test
1 parent 85be99e commit 4f1052e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pandas/tests/arrays/boolean/test_logical.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,20 @@ def test_eq_mismatched_type(self, other):
6060
expected = pd.array([True, True])
6161
tm.assert_extension_array_equal(result, expected)
6262

63-
def test_logical_length_mismatch_raises(self, all_logical_operators):
63+
@pytest.mark.parametrize("other", [[True, False], [True, False, True, False]])
64+
def test_logical_length_mismatch_raises(self, other, all_logical_operators):
6465
op_name = all_logical_operators
6566
a = pd.array([True, False, None], dtype="boolean")
6667
msg = "Lengths must match"
6768

6869
with pytest.raises(ValueError, match=msg):
69-
getattr(a, op_name)([True, False])
70+
getattr(a, op_name)(other)
7071

7172
with pytest.raises(ValueError, match=msg):
72-
getattr(a, op_name)(np.array([True, False]))
73+
getattr(a, op_name)(np.array(other))
7374

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

7778
def test_logical_nan_raises(self, all_logical_operators):
7879
op_name = all_logical_operators

0 commit comments

Comments
 (0)