-
Notifications
You must be signed in to change notification settings - Fork 152
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
fix: comment from review #528
Merged
george-zubrienko
merged 2 commits into
lidatong:master
from
PJCampi:fix-apply-global-config-globally
May 10, 2024
Merged
fix: comment from review #528
george-zubrienko
merged 2 commits into
lidatong:master
from
PJCampi:fix-apply-global-config-globally
May 10, 2024
Conversation
This file contains 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
rtsscy
approved these changes
May 9, 2024
In the failing tests, the dict value type is a Union of two dataclasses while the dict value instance is an instance of one of the two dataclasses. If `is_dataclass` is asserted before `_is_supported_generic`, some tests fail because the value is a dataclass but `_decode_dataclass` is heavily relying on the type being a dataclass (f.ex. it calls `fields(cls)`) and Union isn't. If we unpack the union of dataclasses via _is_supported_generic first everything works fine. Hence my change. Before my change, the code checked whether the **collection** was a dataclass (`is_dataclass(type_) or is_dataclass(xs)`) so the second assert was always false. I assumed it was just a bug. Our tests did not fail in that original code because the `is_dataclass(Union) or is_dataclass(dict)` predicate failed (the collection is not a dataclass) and then the code went on decoding the `Union` and that worked fine (which means that my incorrect code also passed all tests). I can also roll back the refactoring to _decode_type and keep the code as it was (with the extra conditional branch for checking against the global configuration) if you think this is too risky. It's a shame there is no test of the _is_dataclass(value) branch because I actually doubt that it ever worked (cause, as mentioned the class must also be a dataclass for things like `fields(cls)` to work)
george-zubrienko
approved these changes
May 10, 2024
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.
Hey sorry for this slipping through review - thanks for correction!
renovate bot
added a commit
to ixm-one/pytest-cmake-presets
that referenced
this pull request
May 10, 2024
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [dataclasses-json](https://togithub.com/lidatong/dataclasses-json) ([changelog](https://togithub.com/lidatong/dataclasses-json/releases)) | `0.6.5` -> `0.6.6` | [![age](https://developer.mend.io/api/mc/badges/age/pypi/dataclasses-json/0.6.6?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/dataclasses-json/0.6.6?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/dataclasses-json/0.6.5/0.6.6?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/dataclasses-json/0.6.5/0.6.6?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>lidatong/dataclasses-json (dataclasses-json)</summary> ### [`v0.6.6`](https://togithub.com/lidatong/dataclasses-json/releases/tag/v0.6.6) [Compare Source](https://togithub.com/lidatong/dataclasses-json/compare/v0.6.5...v0.6.6) ##### What's Changed - fix: comment from review by [@​PJCampi](https://togithub.com/PJCampi) in [lidatong/dataclasses-json#528 **Full Changelog**: lidatong/dataclasses-json@v0.6.5...v0.6.6 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/ixm-one/pytest-cmake-presets). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNTEuMiIsInVwZGF0ZWRJblZlciI6IjM3LjM1MS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZTpkZXBlbmRlbmNpZXMiXX0=--> Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.
@rtsscy here you go. Thanks for noticing!