Skip to content

DOC: Remove preference for pytest paradigm in assert_raises_regex #16518

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions pandas/util/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2424,15 +2424,8 @@ def assert_raises_regex(_exception, _regexp, _callable=None,
Check that the specified Exception is raised and that the error message
matches a given regular expression pattern. This may be a regular
expression object or a string containing a regular expression suitable
for use by `re.search()`.

This is a port of the `assertRaisesRegexp` function from unittest in
Python 2.7. However, with our migration to `pytest`, please refrain
from using this. Instead, use the following paradigm:

with pytest.raises(_exception) as exc_info:
func(*args, **kwargs)
exc_info.matches(reg_exp)
for use by `re.search()`. This is a port of the `assertRaisesRegexp`
function from unittest in Python 2.7.

Examples
--------
Expand Down