Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 of 3 tasks
chalmerlowe opened this issue Jun 4, 2025 · 2 comments · May be fixed by #61577
Open
2 of 3 tasks

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

chalmerlowe opened this issue Jun 4, 2025 · 2 comments · May be fixed by #61577
Labels
Error Reporting Incorrect or improved errors from pandas good first issue Testing pandas testing functions or related to the test suite

Comments

@chalmerlowe
Copy link
Contributor

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

@chalmerlowe chalmerlowe added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jun 4, 2025
@rhshadrach
Copy link
Member

Thanks for the report.

pandas release 2.2.3

To be sure, we'd only fix these on main. So it's not too important for us if this is in the 2.2.3 release. Does that cause you any issues?

For test_take_pandas_style_negative_raises, this is now fixed on main, but at least some of the others you listed are not. PR to update these are welcome.

@rhshadrach rhshadrach added Testing pandas testing functions or related to the test suite Warnings Warnings that appear or should be added to pandas Error Reporting Incorrect or improved errors from pandas good first issue and removed Needs Triage Issue that has not been reviewed by a pandas team member Warnings Warnings that appear or should be added to pandas Bug labels Jun 5, 2025
@iabhi4 iabhi4 linked a pull request Jun 5, 2025 that will close this issue
2 tasks
@chalmerlowe
Copy link
Contributor Author

I am not worried about having any of these backported to released versions of pandas. Getting them into main and queued up for inclusion in the next release should be sufficient.

Will take a look at the PR issued by @iabhi4 for completeness and correctness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas good first issue Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants