numpy.testing.assert_raises_regex

numpy.testing.assert_raises_regex(exception_class, expected_regexp, callable_obj=None, *args, **kwargs)[source]

Fail unless an exception of class exception_class and with message that matches expected_regexp is thrown by callable when invoked with arguments args and keyword arguments kwargs.

Name of this function adheres to Python 3.2+ reference, but should work in all versions down to 2.6.