Several unit tests from mri/tests/test_fourier_adjoint.py (and potentially other files) have wrongly formulated assertions, mostly based on a misuse of the numpy.all function. This, for example was fixed in PR #136:
self.assertFalse((normalized_samples.all() < 0.5 and normalized_samples.all() >= -0.5))
The intended goal is to check if all elements in the array normalized_samples are within the [-0.5; 0.5[ interval. However, normalized_samples.all() just checks if all elements are non-zero, which is statistically true since the test inputs are uniformly random. Following that, the assertion just checks if True < 0.5 and True >= -0.5, which is False and matches the unexpected assertFalse function.
While this example was fixed, several other tests with similar formulations were observed and should be fixed to reflect their intended uses.
Several unit tests from
mri/tests/test_fourier_adjoint.py
(and potentially other files) have wrongly formulated assertions, mostly based on a misuse of the numpy.all function. This, for example was fixed in PR #136:self.assertFalse((normalized_samples.all() < 0.5 and normalized_samples.all() >= -0.5))
The intended goal is to check if all elements in the array
normalized_samples
are within the [-0.5; 0.5[ interval. However,normalized_samples.all()
just checks if all elements are non-zero, which is statistically true since the test inputs are uniformly random. Following that, the assertion just checks ifTrue < 0.5 and True >= -0.5
, which is False and matches the unexpectedassertFalse
function.While this example was fixed, several other tests with similar formulations were observed and should be fixed to reflect their intended uses.