[Numpy-discussion] using assertEqual in unittest to test two np.ndarray?

Grissiom chaos.proton@gmail....
Sat Mar 21 05:30:40 CDT 2009


On Sat, Mar 21, 2009 at 10:15, <josef.pktd@gmail.com> wrote:
>
> The testing assert functions are not well documented, I usually just
> use assert_array_almost_equal with decimal precision for float arrays.
> useful is also assert_()  which is better than the assert statement
> since it survives optimization flag for python compile.
>
> You can browse the help editor
> http://docs.scipy.org/numpy/docs/numpy.testing.utils/
> To see the precise definition and difference between the different
> asserts you have to check the source, source button on editor page.
>
> There are also the
> http://projects.scipy.org/numpy/wiki/TestingGuidelines , if you
> haven't seen them yet, they describe the general test setup with nose
> but not the assert functions.
>
> Josef
>
> If you know where to look there is some information:
>
> >>> help(numpy.testing.utils)
> Help on module numpy.testing.utils in numpy.testing:
>
> NAME
>    numpy.testing.utils - Utility function to facilitate testing.
>
> FILE
>    c:\programs\python25\lib\site-packages\numpy\testing\utils.py
>
> FUNCTIONS
>    assert_almost_equal(actual, desired, decimal=7, err_msg='',
> verbose=True)
>        Raise an assertion if two items are not equal.
>
>        I think this should be part of unittest.py
>
>        The test i
>
> ...
>

Thanks really~ It helped a lot. ;)

-- 
Cheers,
Grissiom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090321/21c80772/attachment.html 


More information about the Numpy-discussion mailing list