Test Support (numpy.testing)

Common test support for all numpy test scripts.

This single module should provide all the common functionality for numpy tests in a single location, so that test scripts can just import it and work right away.

Asserts

assert_almost_equal(actual, desired[, ...]) Raise an assertion if two items are not equal up to desired precision.
assert_approx_equal(actual, desired[, ...]) Raise an assertion if two items are not equal up to significant digits.
assert_array_almost_equal(x, y[, decimal, ...]) Raise an assertion if two objects are not equal up to desired precision.
assert_array_equal(x, y[, err_msg, verbose]) Raise an assertion if two array_like objects are not equal.
assert_array_less(x, y[, err_msg, verbose]) Raise an assertion if two array_like objects are not ordered by less than.
assert_equal(actual, desired[, err_msg, verbose]) Raise an assertion if two objects are not equal.
assert_raises(exception_class, callable, ...) Fail unless an exception of class exception_class is thrown by callable when invoked with arguments args and keyword arguments kwargs.
assert_warns(warning_class, func, *args, **kw) Fail unless the given callable throws the specified warning.
assert_string_equal(actual, desired) Test if two strings are equal.

Decorators

decorators.deprecated(conditional=True) Filter deprecation warnings while running the test suite.
decorators.knownfailureif(fail_condition[, msg]) Make function raise KnownFailureTest exception if given condition is true.
decorators.setastest(tf=True) Signals to nose that this function is or is not a test.
decorators.skipif(skip_condition[, msg]) Make function raise SkipTest exception if a given condition is true.
decorators.slow(t) Label a test as ‘slow’.
decorate_methods(cls, decorator[, testmatch]) Apply a decorator to all methods in a class matching a regular expression.

Test Running

Tester Nose test runner.
run_module_suite(file_to_run=None)
rundocs(filename=None[, raise_on_error]) Run doctests found in the given file.

Table Of Contents

Previous topic

numpy.getbufsize

Next topic

numpy.testing.assert_almost_equal

This Page