Skip to content

BUG: regex match in compliance tests no longer match pytest expected inputs #61557

Closed
@chalmerlowe

Description

@chalmerlowe

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

N/A

Issue Description

When I run compliance tests in python-db-dtype-pandas (a support file used by python-bigquery) I am getting multiple warnings (which cause test failures) due to a recent update in how pytest handles regex matches.

In pandas release 2.2.3 there is a snippet of code:

def test_take_pandas_style_negative_raises(self, data, na_value):
    with pytest.raises(ValueError, match=""):

Pytest returns this Warning:

pytest.PytestWarning: matching against an empty string will *always* pass. If you want to check for an empty message you need to pass '^$'. If you don't want to match you should pass `None` or leave out the parameter.

This warning shows up in association with each of these pandas tests (it may occur with other tests, but these are the only ones that my tests revealed.):

FAILED ...::TestGetitem::test_take_pandas_style_negative_raises
FAILED ...::TestMethods::test_argmax_argmin_no_skipna_notimplemented
FAILED ...::TestSetitem::test_setitem_invalid
FAILED ...::TestJSONArrayGetitem::test_take_pandas_style_negative_raises
FAILED ...::TestJSONArrayMethods::test_argmax_argmin_no_skipna_notimplemented
FAILED ...::TestJSONArraySetitem::test_setitem_invalid

Expected Behavior

N/A

Installed Versions

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Error ReportingIncorrect or improved errors from pandasTestingpandas testing functions or related to the test suitegood first issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions