assertWarnsRegex(warning, regex, callable, *args, **kwds)
assertWarnsRegex(warning, regex, msg=None)
Like assertWarns() but also tests that regex matches on the message of the triggered warning. regex may be a regular expression object or a string containing a regular expression suitable for use by re.search(). Example:
self.assertWarnsRegex(DeprecationWarning,
r'legacy_function\(\) is deprecated',
legacy_function, 'XYZ')
or:
with self.assertWarnsR