assertWarnsRegex(expected_warning, expected_regex, callable_obj=None, *args, **kwargs)¶
Asserts that the message in a triggered warning matches a regexp. Basic functioning is similar to assertWarns() with the addition that only warnings whose messages also match the regular expression are considered successful matches.
expected_warning: Warning class expected to be triggered. expected_regex: Regex (re pattern object or string) expectedto be found in error message.
callable_obj: Function to be called. msg: Optional message used in case of failure. Can only be usedwhen assertWarnsRegex is used as a context manager.
args: Extra args. kwargs: Extra kwargs.