[Numpy-discussion] portable doctests despite floating points numbers

Sébastien Barthélemy barthelemy@crans....
Thu Oct 21 10:06:04 CDT 2010


I've haven't found any clean way. So I'll use "numpy.allclose" in my doctests.

It will be harder to read, less interactive-session-like, but it might show the
reader how compare floats properly.

On Fri, Oct 15, 2010 at 2:05 PM, Fabrice Silva <silva@lma.cnrs-mrs.fr> wrote:
> Maybe you should not rely on doctest to do the comparison between
> computed and expected result. You could use assert_* functions from
> http://docs.scipy.org/doc/numpy/reference/routines.testing.html

I didn't knew about them, they might prove useful too, thanks!

Cheers


More information about the NumPy-Discussion mailing list