SciPy

numpy.testing.assert_raises_regex

numpy.testing.assert_raises_regex(exception_class, expected_regexp, callable, *args, **kwargs) assert_raises_regex(exception_class, expected_regexp)[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.

Alternatively, can be used as a context manager like assert_raises.

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

Notes

New in version 1.9.0.