sklearn.utils.testing.assert_raise_message — scikit-learn 0.20.4 documentation (original) (raw)
sklearn.utils.testing.
assert_raise_message
(exceptions, message, function, *args, **kwargs)[source]¶
Helper function to test the message raised in an exception.
Given an exception, a callable to raise the exception, and a message string, tests that the correct exception is raised and that the message is a substring of the error thrown. Used to test that the specific message thrown during an exception is correct.
Parameters: | exceptions : exception or tuple of exception An Exception object. message : str The error message or a substring of the error message. function : callable Callable object to raise error. *args : the positional arguments to function. **kwargs : the keyword arguments to function. |
---|