diff options
author | Jarrod Millman <millman@berkeley.edu> | 2008-09-02 20:13:17 +0000 |
---|---|---|
committer | Jarrod Millman <millman@berkeley.edu> | 2008-09-02 20:13:17 +0000 |
commit | a4a7966cf7191c28a7054127fd3717d6c760d556 (patch) | |
tree | d7b05156c94176dc7cd540094a2868ecc9d49f36 | |
parent | 87d85a0dbd8ec019a233ed921cd7cd2d9e6234c4 (diff) | |
download | numpy-a4a7966cf7191c28a7054127fd3717d6c760d556.tar.gz |
pulling out testing docs from distutils docs
-rw-r--r-- | doc/DISTUTILS.txt | 52 | ||||
-rw-r--r-- | doc/TESTS.txt | 52 |
2 files changed, 52 insertions, 52 deletions
diff --git a/doc/DISTUTILS.txt b/doc/DISTUTILS.txt index 5dcc867cb..2e7dacefa 100644 --- a/doc/DISTUTILS.txt +++ b/doc/DISTUTILS.txt @@ -453,58 +453,6 @@ The header of a typical ``__init__.py`` is:: from numpy.testing import NumpyTest test = NumpyTest().test -The ``tests/`` directory -'''''''''''''''''''''''' - -Ideally, every Python code, extension module, or subpackage in Scipy -package directory should have the corresponding ``test_<name>.py`` -file in ``tests/`` directory. This file should define classes -derived from the ``numpy.testing.TestCase`` class (or from -``unittest.TestCase``) and have names starting with ``test``. The methods -of these classes whose names contain ``test`` or start with ``bench`` are -automatically picked up by the test machinery. - -A minimal example of a ``test_yyy.py`` file that implements tests for -a NumPy package module ``numpy.xxx.yyy`` containing a function -``zzz()``, is shown below:: - - import sys - from numpy.testing import * - - # import xxx symbols - from numpy.xxx.yyy import zzz - - - class test_zzz(TestCase): - def test_simple(self, level=1): - assert zzz()=='Hello from zzz' - #... - - if __name__ == "__main__": - run_module_tests(file) - -Note that all classes that are inherited from ``TestCase`` class, are -automatically picked up by the test runner. - -``numpy.testing`` module provides also the following convenience -functions:: - - assert_equal(actual,desired,err_msg='',verbose=1) - assert_almost_equal(actual,desired,decimal=7,err_msg='',verbose=1) - assert_approx_equal(actual,desired,significant=7,err_msg='',verbose=1) - assert_array_equal(x,y,err_msg='') - assert_array_almost_equal(x,y,decimal=6,err_msg='') - rand(*shape) # returns random array with a given shape - -To run all test scripts of the module ``xxx``, execute in Python: - - >>> import numpy - >>> numpy.xxx.test() - -To run only tests for ``xxx.yyy`` module, execute: - - >>> NumpyTest('xxx.yyy').test(level=1,verbosity=1) - Extra features in NumPy Distutils ''''''''''''''''''''''''''''''''' diff --git a/doc/TESTS.txt b/doc/TESTS.txt new file mode 100644 index 000000000..164beb775 --- /dev/null +++ b/doc/TESTS.txt @@ -0,0 +1,52 @@ +The ``tests/`` directory +'''''''''''''''''''''''' + +Ideally, every Python code, extension module, or subpackage in Scipy +package directory should have the corresponding ``test_<name>.py`` +file in ``tests/`` directory. This file should define classes +derived from the ``numpy.testing.TestCase`` class (or from +``unittest.TestCase``) and have names starting with ``test``. The methods +of these classes whose names contain ``test`` or start with ``bench`` are +automatically picked up by the test machinery. + +A minimal example of a ``test_yyy.py`` file that implements tests for +a NumPy package module ``numpy.xxx.yyy`` containing a function +``zzz()``, is shown below:: + + import sys + from numpy.testing import * + + # import xxx symbols + from numpy.xxx.yyy import zzz + + + class test_zzz(TestCase): + def test_simple(self, level=1): + assert zzz()=='Hello from zzz' + #... + + if __name__ == "__main__": + run_module_tests(file) + +Note that all classes that are inherited from ``TestCase`` class, are +automatically picked up by the test runner. + +``numpy.testing`` module provides also the following convenience +functions:: + + assert_equal(actual,desired,err_msg='',verbose=1) + assert_almost_equal(actual,desired,decimal=7,err_msg='',verbose=1) + assert_approx_equal(actual,desired,significant=7,err_msg='',verbose=1) + assert_array_equal(x,y,err_msg='') + assert_array_almost_equal(x,y,decimal=6,err_msg='') + rand(*shape) # returns random array with a given shape + +To run all test scripts of the module ``xxx``, execute in Python: + + >>> import numpy + >>> numpy.xxx.test() + +To run only tests for ``xxx.yyy`` module, execute: + + >>> NumpyTest('xxx.yyy').test(level=1,verbosity=1) + |