Preserve JsonPointer subclasses when joining - #78
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused implementation is correct and adequately covered by regression tests.
Review effort: Balanced
Findings: None
What changed in this PR
Preserves JsonPointer subclasses when joining pointers.
Changes:
- Constructs joined pointers through the left operand’s
from_partsfactory. - Adds regression tests for suffix types, escaping, and chained
/operations.
| File | Description |
|---|---|
jsonpointer.py |
Preserves the left operand’s subclass during joins. |
tests.py |
Covers subclass-preserving joins and chaining. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Owner
|
thanks! |
This file contains hidden or 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
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.
Joining a
JsonPointersubclass currently returns a baseJsonPointer, losing subclass behavior. Construct the result through the left operand's existingfrom_partsfactory so bothjoin()and/preserve its class.Suffix handling stays the same, including base pointers, different subclasses, strings and part lists. Regression tests cover those inputs, escaped segments and chained
/operations.Fixes #64.
Validation on Windows / Python 3.12:
python -m unittest: 30 tests passed, including doctests. The new regressions fail before the fix.coverage run --source=jsonpointer -m unittestandcoverage report -m: 100% statement/branch coverage.flake8: passed.python -m build --no-isolation: sdist and wheel built; installed-wheel consumer checks passed.Other Python versions and the hosted Ubuntu matrix have not been run locally.