Issue #4496: use a better way to compare ndarrays in unit-test.