W3cubDocs

/scikit-learn

sklearn.utils.testing.assert_raise_message

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.

© 2007–2018 The scikit-learn developers
Licensed under the 3-clause BSD License.
http://scikit-learn.org/stable/modules/generated/sklearn.utils.testing.assert_raise_message.html