Skip to content

BUG: Some existing tests are now failing for latest numexpr version 2.13.. Addition and Multiplication of Booleans no longer issues the expected warning #62545

@eoincondron

Description

@eoincondron

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

# reproducing involves running this test with numexpr versions 2.13.0 where it passes
# and version 2.13.1 where it fails due to the warning not being issued. There are 5 failing tests in total 

def test_add_list_to_masked_array_boolean(self, request):
    # GH#22962
    warning = (
        UserWarning
        if request.node.callspec.id == "numexpr" and NUMEXPR_INSTALLED
        else None
    )
    ser = Series([True, None, False], dtype="boolean")
    msg = "operator is not supported by numexpr for the bool dtype"
    with tm.assert_produces_warning(warning, match=msg):
        result = ser + [True, None, True]
    expected = Series([True, None, True], dtype="boolean")
    tm.assert_series_equal(result, expected)

Issue Description

As of numexpr version 2.13.1, we have failing tests in

pandas/tests/frame/test_arithmetic.py
pandas/tests/series/test_arithmetic.py
pandas/tests/test_expressions.py

All are related to warnings no longer being emitted when adding and multiplying bools.

Expected Behavior

    def test_add_list_to_masked_array_boolean(self, request):
        ser = Series([True, None, False], dtype="boolean")
        with tm.assert_produces_warning(None):
            result = ser + [True, None, True]
        expected = Series([True, None, True], dtype="boolean")
        tm.assert_series_equal(result, expected)

test_add_list_to_masked_array_boolean()

Installed Versions

Replace this line with the output of pd.show_versions()

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDependenciesRequired and optional dependenciesNumeric OperationsArithmetic, Comparison, and Logical operations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions