[SciPy-dev] tests for scipy.integrate
David M. Cooke
cookedm at physics.mcmaster.ca
Wed Nov 16 16:04:56 CST 2005
Arnd Baecker <arnd.baecker at web.de> writes:
> On Wed, 16 Nov 2005, Nils Wagner wrote:
>
> [...]
>
>> I am not familiar with writing tests. However I have attached a small
>> example,
>
> Hi Nils,
>
> I also have no experience in writing unittests, but it
> seems pretty straightforward.
> For example looking at scipy/Lib/linalg/tests/test_basic.py
> suggests that one has to
> a) create a subdirectory called `tests`
> b) add a test file `test_<something>.py`, e.g. `test_simple.py`
> which contains
You can also do doctests now. Here's a snippet from
test_polynomial.py:
"""
>>> import scipy.base as nx
>>> from scipy.base.polynomial import poly1d
>>> p = poly1d([1.,2,3])
>>> p
poly1d([ 1., 2., 3.])
>>> print p
2
1 x + 2 x + 3
>>> q = poly1d([3.,2,1])
>>> q
poly1d([ 3., 2., 1.])
>>> print q
2
3 x + 2 x + 1
"""
from scipy.test.testing import *
import doctest
def test_suite(level=1):
return doctest.DocTestSuite()
if __name__ == "__main__":
ScipyTest().run()
--
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca
More information about the Scipy-dev
mailing list