[Numpy-discussion] unittest for np.random.poisson with lambda=0
David Cournapeau
david@ar.media.kyoto-u.ac...
Wed Nov 11 23:15:20 CST 2009
Sebastian Haase wrote:
> Thanks Robert,
> Just for the archive: I hope the problem I was thinking of is what is
> referred to here:
> http://mail.scipy.org/pipermail/numpy-discussion/2005-July/004992.html
> i.e. it should have been fixed as bug #1123145 in Numeric.
>
> (see also here:
> https://nanohub.org/infrastructure/rappture-runtime/browser/trunk/Numeric-24.2/changes.txt?rev=42
> )
>
> I still haven't learned how to write unittests .... (sorry)
That's very easy. Assuming you have a new random generator foo which
should always return one, it may be as easy as writing:
from numpy.random import foo
def test_foo():
assert foo() == 1
In numpy/random/test_random. You can follow the nose doc (or other unit
tests) for more complex examples.
If you are unsure about how to write something, just create an issue to
numpy trac with a patch, and regularly bother us until we review it.
cheers,
David
More information about the NumPy-Discussion
mailing list