assertWarnsRegex(expected_warning, expected_regex, *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.
args: Function to be called and extra positional args. kwargs: Extra kwargs. msg: Optional message used in case of failure. Can only be usedwhen assertWarnsRegex is used as a context manager.