-
-
Notifications
You must be signed in to change notification settings - Fork 446
Fix features issues with init param and property setter #5646
8000New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix features issues with init param and property setter #5646
Conversation
Sorry, meant to open this in my fork. |
Codecov Report
@@ Coverage Diff @@
## main #5646 +/- ##
==========================================
+ Coverage 89.81% 89.84% +0.02%
==========================================
Files 611 611
Lines 51560 51640 +80
==========================================
+ Hits 46308 46394 +86
+ Misses 5252 5246 -6
... and 4 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@brisvag : added you as a reviewer since you poked the features and found these bugs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I really like the mostly identical implementation across layers... We really need to pick the features work up again ;)
One thing: there's a few codecov warning about the setters not being tested. Maybe it's good to add some test for those as well?
Thanks for the quick review.
Thanks codecov - it makes a fair point. Can you think of an interesting usage of the One thing I might do is to modify those tests. That way they handle setting the default value in the three ways we support (initializer param, in-place modification, property setter) - what do you think? Typically, I don't like testing multiple actions in the same test, but they are at least exercising the same usage/behavior. And I'm wary of adding a very similar (i.e. almost duplicate) test for each of the supported layers. |
I did that in faf9622. If you don't like it, I'll revert it and write some other separate tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's definitely good enough imo!
I think the CI failure is unrelated and possibly related to #5657 instead. Therefore, this is ready to merge, though I might hold off on merging until that CI action is resolved. |
I think we can merge, this CI failure is everywhere :) |
# Description This introduces a `feature_defaults` init parameter and property setter for the three layer types that support that (points, shapes, and vectors). It also fixes some related issues that occur when adding feature-derived colors when modifying the feature defaults in-place. Note that the `feature_defaults` is deliberately a little different to the `current_properties` setter, as the latter also has the side-effect of setting the feature values of the selected elements to the new current property values. Also, using the `feature_defaults` setter with keys/columns that are extra/missing compared to `features` will result in an error. ## Type of change - [x] Bug-fix (non-breaking change which fixes an issue) - [x] New featur 8000 e (non-breaking change which adds functionality) # References Closes napari#5632 Closes napari#5634 # How has this been tested? - [x] added new tests to cover bugs and setter - [x] all tests pass with my change
# Description This introduces a `feature_defaults` init parameter and property setter for the three layer types that support that (points, shapes, and vectors). It also fixes some related issues that occur when adding feature-derived colors when modifying the feature defaults in-place. Note that the `feature_defaults` is deliberately a little different to the `current_properties` setter, as the latter also has the side-effect of setting the feature values of the selected elements to the new current property values. Also, using the `feature_defaults` setter with keys/columns that are extra/missing compared to `features` will result in an error. ## Type of change - [x] Bug-fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) # References Closes #5632 Closes #5634 # How has this been tested? - [x] added new tests to cover bugs and setter - [x] all tests pass with my change
# Description This introduces a `feature_defaults` init parameter and property setter for the three layer types that support that (points, shapes, and vectors). It also fixes some related issues that occur when adding feature-derived colors when modifying the feature defaults in-place. Note that the `feature_defaults` is deliberately a little different to the `current_properties` setter, as the latter also has the side-effect of setting the feature values of the selected elements to the new current property values. Also, using the `feature_defaults` setter with keys/columns that are extra/missing compared to `features` will result in an error. ## Type of change - [x] Bug-fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) # References Closes #5632 Closes #5634 # How has this been tested? - [x] added new tests to cover bugs and setter - [x] all tests pass with my change
# Description This introduces a `feature_defaults` init parameter and property setter for the three layer types that support that (points, shapes, and vectors). It also fixes some related issues that occur when adding feature-derived colors when modifying the feature defaults in-place. Note that the `feature_defaults` is deliberately a little different to the `current_properties` setter, as the latter also has the side-effect of setting the feature values of the selected elements to the new current property values. Also, using the `feature_defaults` setter with keys/columns that are extra/missing compared to `features` will result in an error. ## Type of change - [x] Bug-fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) # References Closes #5632 Closes #5634 # How has this been tested? - [x] added new tests to cover bugs and setter - [x] all tests pass with my change
# Description This introduces a `feature_defaults` init parameter and property setter for the three layer types that support that (points, shapes, and vectors). It also fixes some related issues that occur when adding feature-derived colors when modifying the feature defaults in-place. Note that the `feature_defaults` is deliberately a little different to the `current_properties` setter, as the latter also has the side-effect of setting the feature values of the selected elements to the new current property values. Also, using the `feature_defaults` setter with keys/columns that are extra/missing compared to `features` will result in an error. ## Type of change - [x] Bug-fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) # References Closes #5632 Closes #5634 # How has this been tested? - [x] added new tests to cover bugs and setter - [x] all tests pass with my change
Description
This introduces a
feature_defaults
init parameter and property setter for the three layer types that support that (points, shapes, and vectors). It also fixes some related issues that occur when adding feature-derived colors when modifying the feature defaults in-place.Note that the
feature_defaults
is deliberately a little different to thecurrent_properties
setter, as the latter also has the side-effect of setting the feature values of the selected elements to the new current property values. Also, using thefeature_defaults
setter with keys/columns that are extra/missing compared tofeatures
will result in an error.Type of change
References
Closes #5632
Closes #5634
How has this been tested?