On Wed, Dec 23, 2020 at 1:06 AM Steven D'Aprano email@example.com wrote:
We're not obligated to take heroic measures to integrate numpy arrays with unittest methods. If we can do so easily, sure, let's fix it.
I think Ivan's suggestion that the assertSequenceEqual method fall back on element-by-element comparisons has some merit.
If there are other common types this helps with, sure. But for numpy, as pointed out elsewhere in this thread, it would still fail for numpy arrays of > 1 dimension.
Personally I think this is really an issue with the structure of unitest -- having a custom assertion for every possibility is intractable.
If you want to test numpy arrays, use the utilities provided by numpy.