Fix bug in previously-daskified Data.flip
#329
Merged
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.
Fix a bug in
Data.flip
, exposed with the following example, which was lifted from the start of thetest_Data_BINARY_AND_UNARY_OPERATORS
test, which is where the bug was noticed:which, on the present
lama-to-dask
branch, runs into:though it is not just a case of converting the
axes
into a sequence if an integer value was provided (both are permitted as values for that keyword), since there is a further issue in the logic for the creation of the indices listindex
by that list comprehension that is, for example, revealed in the failing unit test once it has been unskipped (and with some old syntax converted so it runs to pass/fail rather than error) since that test method appears to have been missed to be reinstate despiteflip
being marked as migrated for #182.Suggested solution context
With a simple adjustment to ensure
axes
is a sequence, namely using:the indices were (as far as the initial unit test failure):
which don't look appropriate, where the printed variables result from the following print calls:
With the change to the list comprehension suggested in this PR, arrived at by taking a look at the current/LAMA code defining
Data.flip
master
, the unit test passes and a resulting print-out of theindex
variable with theaxes
used in each test case, as above, is instead something which looks right, namely: