-
Notifications
You must be signed in to change notification settings - Fork 50
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 jsanitize
when recursive_msonable=True
#728
base: master
Are you sure you want to change the base?
Fix jsanitize
when recursive_msonable=True
#728
Conversation
WalkthroughThe changes in this pull request focus on enhancing the Changes
Assessment against linked issues
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #728 +/- ##
=======================================
Coverage 82.57% 82.57%
=======================================
Files 27 27
Lines 1584 1584
Branches 284 284
=======================================
Hits 1308 1308
Misses 215 215
Partials 61 61 ☔ View full report in Codecov by Sentry. |
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
tests/test_json.py (1)
797-808
: LGTM! Consider improving test readability.The test case effectively verifies recursive MSONable serialization by checking both top-level and nested object fields. The implementation is thorough and well-structured.
Consider renaming the test object for better clarity:
- DoubleGoodMSONClass = GoodMSONClass(1, 2, 3) - DoubleGoodMSONClass.values = [GoodMSONClass(1, 2, 3)] + nested_mson_obj = GoodMSONClass(1, 2, 3) + nested_mson_obj.values = [GoodMSONClass(1, 2, 3)]
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
src/monty/json.py
(1 hunks)tests/test_json.py
(1 hunks)
🔇 Additional comments (1)
src/monty/json.py (1)
995-1001
: Implementation looks good!
The recursive jsanitize call on the output of as_dict()
ensures proper serialization of nested MSONable objects while maintaining all sanitization parameters. This effectively fixes the issue described in PR #726 where nested MSONable objects weren't being properly sanitized.
If approved, could we also get a version release after this PR? 🙏 |
Summary
Closes #726 by fixing the
jsanitize(recursive_msonable=True)
behavior.Checklist
ruff
.mypy
.duecredit
@due.dcite
decorators to reference relevant papers by DOI (example)Summary by CodeRabbit
New Features
jsanitize
function to improve sanitization of MSONable objects, ensuring consistent and thorough data cleaning.Tests
jsanitize
function to validate handling of nested MSONable objects, improving test coverage and reliability.