Skip to content

Commit 3e549f2

Browse files
committed
add and mul operations applied to booleans do not issue a numexpr warning as of version 2.13.1. Remove/adjuste related test cases
1 parent efbf9c6 commit 3e549f2

File tree

3 files changed

+3
-16
lines changed

3 files changed

+3
-16
lines changed

pandas/tests/frame/test_arithmetic.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,8 +1095,6 @@ def test_binop_other(self, op, value, dtype, switch_numexpr_min_elements):
10951095
skip = {
10961096
(operator.truediv, "bool"),
10971097
(operator.pow, "bool"),
1098-
(operator.add, "bool"),
1099-
(operator.mul, "bool"),
11001098
}
11011099

11021100
elem = DummyElement(value, dtype)

pandas/tests/series/test_arithmetic.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import pandas._testing as tm
2626
from pandas.core import ops
2727
from pandas.core.computation import expressions as expr
28-
from pandas.core.computation.check import NUMEXPR_INSTALLED
2928

3029

3130
@pytest.fixture(autouse=True, params=[0, 1000000], ids=["numexpr", "python"])
@@ -348,20 +347,12 @@ def test_add_list_to_masked_array(self, val, dtype):
348347

349348
def test_add_list_to_masked_array_boolean(self, request):
350349
# GH#22962
351-
warning = (
352-
UserWarning
353-
if request.node.callspec.id == "numexpr" and NUMEXPR_INSTALLED
354-
else None
355-
)
356350
ser = Series([True, None, False], dtype="boolean")
357-
msg = "operator is not supported by numexpr for the bool dtype"
358-
with tm.assert_produces_warning(warning, match=msg):
359-
result = ser + [True, None, True]
351+
result = ser + [True, None, True]
360352
expected = Series([True, None, True], dtype="boolean")
361353
tm.assert_series_equal(result, expected)
362354

363-
with tm.assert_produces_warning(warning, match=msg):
364-
result = [True, None, True] + ser
355+
result = [True, None, True] + ser
365356
tm.assert_series_equal(result, expected)
366357

367358

pandas/tests/test_expressions.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,7 @@ def test_bool_ops_raise_on_arithmetic(self, op_str, opname):
317317
with pytest.raises(NotImplementedError, match=err_msg):
318318
f(df, True)
319319

320-
@pytest.mark.parametrize(
321-
"op_str,opname", [("+", "add"), ("*", "mul"), ("-", "sub")]
322-
)
320+
@pytest.mark.parametrize("op_str,opname", [("-", "sub")])
323321
def test_bool_ops_warn_on_arithmetic(self, op_str, opname, monkeypatch):
324322
n = 10
325323
df = DataFrame(

0 commit comments

Comments
 (0)