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. |
| 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.
| 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. |
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 | |
| Run a test module. |
| Run doctests found in the given file. |
| Context manager and decorator doing much the same as |
Guidelines
© 2005–2021 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/1.21/reference/routines.testing.html