Details
-
Type:
Story
-
Status: To Do
-
Resolution: Unresolved
-
Fix Version/s: None
-
Component/s: utils
-
Labels:
Description
lsst.utils.assertFloatsAlmostEqual cannot handle lists of floats. Thus it cannot handle values returned from C++ as std::vector. Similarly for tuples of floats, lists of lists of floats, etc., though those may be rarer.
The usual workaround is to use self.assertTrue(numpy.allclose(arr1, arr2)) but it would be nice not to have to do that.
Also please consider adding a equal_nan flag like numpy.allclose. In both cases it is worth considering using numpy allclose as the code that performs the test.
As Jim says above, I don't think we want to advocate using the numpy.allclose or numpy.testing.assert_array_almost_equal, because they both have a much less stringent default tolerance, and the numpy.testing modules defines things completely differently (number of decimals, instead of relative/absolute tolerance).