Repository navigation
test: make strided out tests compare against an independent reference - #388
Open
antonwolfy wants to merge 2 commits into
Open
antonwolfy wants to merge 2 commits into
antonwolfy wants to merge 2 commits into
Conversation
`test_fft_out_strided`, `test_rfft_out_strided`, `test_irfft_out_strided` and `test_out_strided` passed the same `out` array to both mkl_fft and numpy.fft. Since both return `out`, `result` and `expected` were the same object and the assertions compared `out` with itself, so the tests could not fail. `test_fft_out_strided` also rebound `out` to a contiguous array and so never exercised a strided `out`. Compute the NumPy reference without `out`, assert that `out` is returned, make `out` in `test_fft_out_strided` actually strided, and check that nothing outside of the `out` view is written to.
antonwolfy
requested review from
jharlow-intel,
ndgrigorian,
vlad-perevezentsev and
xaleryb
as code owners
October 6, 2026 12:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four tests that check
out=with strided arrays pass the sameoutto both mkl_fft andnumpy.fft:Both calls return
out, soresult is expectedand the assertion comparesoutwith itself. The tests pass even if mkl_fft writes nothing, or garbage, intoout.test_fft_out_stridedalso rebindsoutto a contiguous array, so despite its name it never tests a stridedout.The affected tests cover 20 parametrized cases, all added in #157:
test_fft1d.py:test_fft_out_strided,test_rfft_out_strided,test_irfft_out_stridedtest_fftnd.py:test_out_stridedChanges
out, as NumPy's owntest_pocketfft.pydoes.outis returned.outintest_fft_out_stridedan actual strided view.outas a view of a sentinel-filled buffer and check that nothing outside the view is written to.Verification
fft/ifft/rfft/irfft/fftn/ifftnwith a stub that returnsoutuntouched. The current tests still pass all 20 cases; the updated tests fail all 20.This is a test-only change, so there is no CHANGELOG entry. Found while reviewing #387.