-
-
Notifications
You must be signed in to change notification settings - Fork 0
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 decode
: properly account for strict_null_handling
when allow_empty_lists
#5
Conversation
WalkthroughThe changes address an issue where the parse method returns incorrect output when both Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant QSCodec
participant DecodeOptions
Client->>QSCodec: Call parse method with strictNullHandling and allowEmptyArrays
QSCodec->>DecodeOptions: Check options.strict_null_handling and leaf is None
DecodeOptions-->>QSCodec: Return true
QSCodec-->>Client: Return empty list
Assessment against linked issues
Poem
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences🚀 Don’t miss a bit, follow what’s new on Codacy. Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more |
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- src/qs_codec/decode.py (1 hunks)
- tests/unit/decode_test.py (1 hunks)
- tests/unit/encode_test.py (1 hunks)
Additional comments not posted (3)
src/qs_codec/decode.py (1)
132-132
: Review the handling of empty lists in_parse_object
.The added condition
options.allow_empty_lists and (leaf == "" or (options.strict_null_handling and leaf is None))
correctly implements the logic to handle empty lists when bothstrict_null_handling
andallow_empty_lists
are enabled. This change aligns with the PR objectives and linked issue requirements.tests/unit/decode_test.py (1)
140-143
: Review the new test methodtest_allow_empty_lists_and_strict_null_handling
.The test method correctly asserts that an empty list is returned when both
strict_null_handling
andallow_empty_lists
are enabled, which matches the expected behavior described in the PR objectives and linked issue. This test is essential for validating the bug fix.tests/unit/encode_test.py (1)
239-243
: Review of new test method:test_empty_list_with_strict_null_handling
This test method correctly verifies the behavior of the
encode
function when handling empty lists with bothstrict_null_handling
andallow_empty_lists
set toTrue
. The assertion checks that the output is"testEmptyList[]"
, which aligns with the expected behavior described in the PR summary and linked issue.The test is well-structured and follows the conventions used in the rest of the test suite. It's good to see that the test parameters (
strict_null_handling
andallow_empty_lists
) are explicitly set, which ensures clarity and correctness in what the test is intended to validate.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5 +/- ##
=======================================
Coverage 96.75% 96.75%
=======================================
Files 16 16
Lines 709 709
=======================================
Hits 686 686
Misses 23 23 ☔ View full report in Codecov by Sentry. |
Description
Fix
decode
output when bothstrict_null_handling
andallow_empty_lists
are set toTrue
.Fixes ljharb/qs#510
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Added new tests
Checklist:
Summary by CodeRabbit
New Features
strict_null_handling
option.Tests