atmqty Manual: Testing

General

If you make changes and additions to the package, the atmqty package provides a variety of way to test the package's code. Note that all the docstring results and comparison graphs assume that all package dependencies are installed. The package may still work if not all package dependencies are installed, but the results may be slightly different. For instance, if the CDAT contributed package sphere is not installed, the relative vorticity will still be calculated by an AtmQty object, but the algorithm used will be order 1 finite-difference, which will give similar but slightly different results from the spectral method from sphere, the latter which is the default of the vort_rel method in the AtmQty object.

Development and testing of the package was done on a Debian GNU/Linux system.

Module Unit Testing Using doctest

All (or nearly all) modules make use of the doctest module which executes all example docstrings in the module. For instance, to check that the theta module passes its docstring unit tests, in the source code directory at the OS command line just type:

>>> python theta.py

If there are no problems, you should get back nothing. See below though for a caveat if you have CDAT 3.3 installed instead of v4.0.

On a minor note, in the Debian release of Python, there is a difference between versions 2.2 and 2.3 as to how the output to stdout from a KeyError exception is formatted: in 2.3, if the key is a string, single quotes are output; in 2.2, no quotes were output. As the docstring unit tests are formatted for Python 2.3, an error will be returned in the unit test for this case.

Unit Testing Using Example Graphs

The doctest unit tests provide a way of helping make sure nothing bad has happened in between code changes. This may not guarantee, however, that the result was correct in the first place. Plots of examples, sometimes comparing to results obtained by others, can help provide this latter type of test.

The following example graphs can function as unit tests:

CDAT 3.3 vs. 4.0

Note that the current docstring output results were generated using CDAT 4.0, not 3.3. Generally there is no difference, but in the case of some CDAT sub-packages, the 4.0 result can be slightly different from the 3.3 result. Keep that in mind when you're evaluating whether or not the package module has failed a unit test.

Return to atmqty Manual Index.
Return to atmqty Home Page.

Valid HTML 4.01! Valid CSS! Updated: May 26, 2004 by Johnny Lin <email address>. License.