numpy.testing.assert_warns(warning_class, func, *args, **kw)[source]
Fail unless the given callable throws the specified warning.
A warning of class warning_class should be thrown by the callable when invoked with arguments args and keyword arguments kwargs. If a different type of warning is thrown, it will not be caught, and the test case will be deemed to have suffered an error.
New in version 1.4.0.
Parameters: |
warning_class : class The class defining the warning that func : callable The callable to test. *args : Arguments Arguments passed to **kwargs : Kwargs Keyword arguments passed to |
---|---|
Returns: |
The value returned by |
© 2008–2016 NumPy Developers
Licensed under the NumPy License.
https://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.testing.assert_warns.html