Test support (numpy.testing) — NumPy v2.2 Manual (original) (raw)
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#
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.
Decorators#
Test running#
Testing custom array containers (numpy.testing.overrides)#
These functions can be useful when testing custom array container implementations which make use of __array_ufunc__
/__array_function__
.
Guidelines#
- Testing guidelines
- Introduction
- Testing NumPy
* Running tests from inside Python
* Running tests from the command line
* Running doctests
* Other methods of running tests - Writing your own tests
* Using C code in tests
* build_and_import_extension
* Labeling tests
* Easier setup and teardown functions / methods
* Parametric tests
* Doctests
* tests/
* __init__.py and setup.py - Tips & Tricks
* Known failures & skipping tests
* Tests on random data
* Documentation for numpy.test
* test