[Numpy-discussion] (no subject)

Olivier Delalleau shish@keba...
Fri Jan 20 05:53:04 CST 2012


Not sure if there's a better way, but you can do it with

assert not numpy.allclose(numpy_result, result)

-=- Olivier

2012/1/20 Hänel Nikolaus Valentin <valentin.haenel@epfl.ch>

> Hi,
>
> I would like to make a sanity test to check that calling the same
> function with different parameters actually gives different results.
>
> I am currently using::
>
>    try:
>        npt.assert_almost_equal(numpy_result, result)
>    except AssertionError:
>        assert True
>    else:
>        assert False
>
> But maybe you have a better way? I couldn't find a 'assert_not_equal'
> and the above just feels stupid.
>
> thanks for your advice.
>
> V-
>
> --
> Valentin Hänel
> Scientific Software Developer
> Blue Brain Project http://bluebrain.epfl.ch/
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120120/e1592eeb/attachment.html 


More information about the NumPy-Discussion mailing list