Ensure all IntendedFor matching params must match#860
Open
mslw wants to merge 2 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #860 +/- ##
==========================================
+ Coverage 83.38% 83.44% +0.05%
==========================================
Files 42 42
Lines 4436 4451 +15
==========================================
+ Hits 3699 3714 +15
Misses 737 737 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
28d05f9 to
b01c54e
Compare
Although `matching_parameters` in `POPULATE_INTENDED_FOR_OPTS` can be
a list with multiple values, it seems that the matching functions
have so far only been tested with a single parameter.
This adds a test for `find_compatible_fmaps_for_run` being called with
two parameters ("ShimSetting" and "CustomAcquisitionLabel"). We test a
situation with three func files and two fmap files, in which only one
fmap-func pairing meets both criteria (and more meet only one). We
assume that all `matching_parameters` must match.
Because the test is concerned with logic of
`find_compatible_fmaps_for_run`, getting relevant information from a
JSON file is mocked (to return preset values) to avoid having to set
up a dataset structure on the filesystem; this should makes the test
simpler and more explicit.
The list of matching_parameters specified in `POPULATE_INTENDED_FOR_OPTS` can have multiple values. The code would loop over them and check if a given field map and run are compatible - but the innermost loop ended with a conditional `continue` statement. Being at the end of the loop, `continue` had no effect. As a result, only the value from the last iteration made it to the conditional in the outer loop, where the field map was taken (or not). In other words, only the last parameter influenced the decision (so the operation was neither "all", nor "any"). This commit replaces `continue` with `break`, which does what the inline comment after `continue`, "don't bother checking more params" suggested. Consequently, this makes "POPULATE_INTENDED_FOR_OPTS" behave as a logical union (all).
b01c54e to
2746e29
Compare
Member
|
Sounds/looks logical but not sure how we missed that in the original implementation or through the use. @pvelasco please have a look |
Contributor
Author
|
I'm likely not adding much here, but I admit that seeing that the code in question was long unchanged gave me pause, but in the end didn't change my conclusion. |
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.
The list of
matching_parametersspecified inPOPULATE_INTENDED_FOR_OPTScan have multiple values. If I'm not mistaken, the code would test all of them, but then act only on the result of the last test, which seems unintended.This assumes that
matching_parametersare to be interpreted asall(), and makes the check behave accordingly.It seems that the matching functions have so far only been tested with a single parameter. This PR adds a test for
find_compatible_fmaps_for_run_unionbeing called with two parameters, and a set of files for which there is one pairing which matches both, but more which match just one. The assumption for the test is that the desired operation isall(), which seems the more logical alternative to me.Fixes #859