Fix handling of default parameters in plans#185
Merged
tpoliaw merged 3 commits intoDiamondLightSource:mainfrom May 12, 2023
tpoliaw:default_args
Merged
Fix handling of default parameters in plans#185tpoliaw merged 3 commits intoDiamondLightSource:mainfrom tpoliaw:default_args
tpoliaw merged 3 commits intoDiamondLightSource:mainfrom
tpoliaw:default_args
Conversation
Contributor
|
Closes #182 |
DiamondJoseph
approved these changes
May 12, 2023
callumforrester
suggested changes
May 12, 2023
Contributor
callumforrester
left a comment
There was a problem hiding this comment.
Makes sense, not sure why CI is unhappy. Could we also have a test for this use case?
Contributor
Author
Because |
Codecov Report
@@ Coverage Diff @@
## main #185 +/- ##
==========================================
+ Coverage 87.53% 87.56% +0.03%
==========================================
Files 41 41
Lines 1091 1102 +11
==========================================
+ Hits 955 965 +10
- Misses 136 137 +1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Passing `None` as the default for a field sets the default to None and is different to there being no default. If a default value is given, it is now returned via a default_factory. This is required to prevent pydantic errors when the default is an ophyd device.
Changing the plan parameter spec to use FieldInfo instead of returning default values meant that comparisons in tests did not behave as required. This adds a Callable wrapper class that allows the internal value to be inspected/compared.
callumforrester
approved these changes
May 12, 2023
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.
Passing
Noneas the default for a field sets the default to None andis different to there being no default.
If a default value is given, it is now returned via a default_factory.
This is required to prevent pydantic errors when the default is an ophyd
device.