mardi 18 septembre 2018

Testing for non-strict inequality with np.testing

np.testing.assert_array_less() tests for strict inequality:

In [1]: np.testing.assert_array_less(1., 1.)
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-1-ea8ee0b762c3> in <module>()
----> 1 np.testing.assert_array_less(1., 1.)

AssertionError: 
Arrays are not less-ordered

apparently there is no parameter to test for non-strict inequality.

How would one test this by still relying on np.testing for its interpretable error messages? (I'd like to avoid assert (a <= b).all())

Aucun commentaire:

Enregistrer un commentaire