numpy.testing.decorators.setastest()

numpy.testing.decorators.setastest(tf=True) [source] Signals to nose that this function is or is not a test. Parameters: tf : bool If True, specifies that the decorated callable is a test. If False, specifies that the decorated callable is not a test. Default is True. Notes This decorator can?t use the nose namespace, because it can be called from a non-test module. See also istest and nottest in nose.tools. Examples setastest can be used in the following way: from numpy.testing.decorat

numpy.testing.decorators.knownfailureif()

numpy.testing.decorators.knownfailureif(fail_condition, msg=None) [source] Make function raise KnownFailureException exception if given condition is true. If the condition is a callable, it is used at runtime to dynamically make the decision. This is useful for tests that may require costly imports, to delay the cost until the test suite is actually executed. Parameters: fail_condition : bool or callable Flag to determine whether to mark the decorated test as a known failure (if True) or

numpy.testing.decorators.deprecated()

numpy.testing.decorators.deprecated(conditional=True) [source] Filter deprecation warnings while running the test suite. This decorator can be used to filter DeprecationWarning?s, to avoid printing them during the test suite run, while checking that the test actually raises a DeprecationWarning. Parameters: conditional : bool or callable, optional Flag to determine whether to mark test as deprecated or not. If the condition is a callable, it is used at runtime to dynamically make the deci

numpy.testing.decorate_methods()

numpy.testing.decorate_methods(cls, decorator, testmatch=None) [source] Apply a decorator to all methods in a class matching a regular expression. The given decorator is applied to all public methods of cls that are matched by the regular expression testmatch (testmatch.search(methodname)). Methods that are private, i.e. start with an underscore, are ignored. Parameters: cls : class Class whose methods to decorate. decorator : function Decorator to apply to methods testmatch : compiled

numpy.testing.assert_warns()

numpy.testing.assert_warns(warning_class, *args, **kwargs) [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. If called with all arguments other than the warning class omitted, may be used as a context manager: with asser

numpy.testing.assert_string_equal()

numpy.testing.assert_string_equal(actual, desired) [source] Test if two strings are equal. If the given strings are equal, assert_string_equal does nothing. If they are not equal, an AssertionError is raised, and the diff between the strings is shown. Parameters: actual : str The string to test for equality against the expected string. desired : str The expected string. Examples >>> np.testing.assert_string_equal('abc', 'abc') >>> np.testing.assert_string_equal('abc'

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.

numpy.testing.assert_raises()

numpy.testing.assert_raises(exception_class, callable, *args, **kwargs) [source] Fail unless an exception of class exception_class is thrown by callable when invoked with arguments args and keyword arguments kwargs. If a different type of exception is thrown, it will not be caught, and the test case will be deemed to have suffered an error, exactly as for an unexpected exception. Alternatively, assert_raises can be used as a context manager: >>> from numpy.testing import assert_rai

numpy.testing.assert_equal()

numpy.testing.assert_equal(actual, desired, err_msg='', verbose=True) [source] Raises an AssertionError if two objects are not equal. Given two objects (scalars, lists, tuples, dictionaries or numpy arrays), check that all elements of these objects are equal. An exception is raised at the first conflicting values. Parameters: actual : array_like The object to check. desired : array_like The expected object. err_msg : str, optional The error message to be printed in case of failure. v

numpy.testing.assert_array_max_ulp()

numpy.testing.assert_array_max_ulp(a, b, maxulp=1, dtype=None) [source] Check that all items of arrays differ in at most N Units in the Last Place. Parameters: a, b : array_like Input arrays to be compared. maxulp : int, optional The maximum number of units in the last place that elements of a and b can differ. Default is 1. dtype : dtype, optional Data-type to convert a and b to if given. Default is None. Returns: ret : ndarray Array containing number of representable floating po