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. For background, see the Testing Guidelines
Asserts#
|
Raises an AssertionError if two objects are not equal up to desired tolerance. |
|
Compare two arrays relatively to their spacing. |
|
Check that all items of arrays differ in at most N Units in the Last Place. |
|
Raises an AssertionError if two array_like objects are not equal. |
|
Raises an AssertionError if two array_like objects are not ordered by less than. |
|
Raises an AssertionError if two objects are not equal. |
|
Fail unless an exception of class exception_class is thrown by callable when invoked with arguments args and keyword arguments kwargs. |
|
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. |
|
Fail unless the given callable throws the specified warning. |
|
Fail if the given callable produces any warnings. |
|
Fail if the given callable produces any reference cycles. |
|
Test if two strings are equal. |
Asserts (not recommended)#
It is recommended to use one of assert_allclose
,
assert_array_almost_equal_nulp
or assert_array_max_ulp
instead of these
functions for more consistent floating point comparisons.
|
Assert that works in release mode. |
|
Raises an AssertionError if two items are not equal up to desired precision. |
|
Raises an AssertionError if two items are not equal up to significant digits. |
|
Raises an AssertionError if two objects are not equal up to desired precision. |
|
Test if two objects are equal, and print an error message if test fails. |
Decorators#
|
Deprecated since version 1.21. |
|
Deprecated since version 1.21. |
|
Deprecated since version 1.21. |
|
Deprecated since version 1.21. |
|
Deprecated since version 1.21. |
|
Apply a decorator to all methods in a class matching a regular expression. |
Test Running#
alias of |
|
|
Context manager that resets warning registry for catching warnings |
|
Return elapsed time for executing code in the namespace of the caller. |
|
Run a test module. |
|
Run doctests found in the given file. |
|
Context manager and decorator doing much the same as |