-
Notifications
You must be signed in to change notification settings - Fork 37
New 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
feat(amber): add property matcher support #245
Conversation
Codecov Report
@@ Coverage Diff @@
## master #245 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 16 18 +2
Lines 880 939 +59
=========================================
+ Hits 880 939 +59 |
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.
Generally LGTM. Can you update the README.md? We don't have this new behaviour documented anywhere
@noahnu will do. Do you have any thoughts on the potential breaking nature of the change. |
Since the serializer is a public API, yes I believe it's a breaking change. How do we prevent this in the future? A note to use **kwargs? What do other python projects do? |
If you recall the Django case that came up, where we don't want to load an attribute, is there a way to match before the attribute is accessed? Some way to check type without triggering a property get. |
DataSerializer.write_file(snapshot_fossil_to_update) | ||
|
||
|
||
__all__ = ["AmberSnapshotExtension", "DataSerializer"] |
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.
@noahnu keeping this for backwards compat, but I think the DataSerializer
should be an internal interface
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.
Minor doc comments. Feel free to merge after fixing docs.
| Argument | Description | | ||
| --------- | ---------------------------------------------------------------------------------------------------------------------------------- | | ||
| `mapping` | Dict of path string to tuples of class types | | ||
| `types` | Tuple of class types used if none of the path strings from the mapping are matched | |
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.
Does it only work on class types? What about primitive types?
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.
Primitives work as well e.g. https://github.com/tophat/syrupy/blob/6fa24059755cc29524ce223993bd3e6392ecb6d5/tests/test_matchers.py#L28-L33
# [0.5.0](v0.4.4...v0.5.0) (2020-06-09) ### Features * **amber:** add property matcher support ([#245](#245)) ([83ded3c](83ded3c))
🎉 This PR is included in version 0.5.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Description
Support property matchers
https://github.com/tophat/syrupy/blob/6fa24059755cc29524ce223993bd3e6392ecb6d5/tests/test_matchers.py#L28-L33
Related Issues
Checklist
Additional Comments