Replace usage of np.allclose
in testing with assert_allclose
#380
Labels
bug
Something isn't working
np.allclose
in testing with assert_allclose
#380
I was expecting these two commands to be equivalent:
Turns out
np.allclose
broadcasts the inputs before testing, so this does not guarantee the inputs are the correct shape. This is a good reason to prefernp.testing.assert_allclose(a, b)
overassert np.allclose(a, b)
. I can sort of see why it does it - the broadcasting is such a fundamental part of numpy that it happens first? - but it is counterintuitive.I've used
np.allclose
a lot in the tests. I doubt we've got any issues, but it's tempting fate.The text was updated successfully, but these errors were encountered: