Skip to content

Handle source pointer objects in move location helpers - #237

Merged
stefankoegl merged 1 commit into
stefankoegl:masterfrom
ice-pring:fix/from-pointer-location-helpers
Oct 24, 2026
Merged

stefankoegl merged 1 commit into
stefankoegl:masterfrom
ice-pring:fix/from-pointer-location-helpers

Conversation

@ice-pring

Copy link
Copy Markdown
Contributor

MoveOperation accepts a JsonPointer object in from, but its public source-location helpers try to parse that object as a string. Reading from_path or from_key, or changing the source with set_from_part(), therefore raises TypeError even though the operation can be applied.

Reuse _from_pointer() in those three places, as apply() already does. Added regressions for plain and custom pointer classes, including editing the source and applying the resulting move.

Validation:

  • The three added test methods produce six subtest errors before the fix; all eight source-location test methods pass afterward.
  • Windows CPython 3.12.14 and 3.14.5: each full example/doctest suite runs 217 tests with one platform skip, and all 20 Hypothesis property tests pass.
  • Ubuntu 24.04 / CPython 3.12.3: all 217 example/doctest tests and all 20 Hypothesis property tests pass, with no skips.
  • Source line and branch coverage: 100%.
  • Flake8 syntax/name checks and git diff --check pass.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused fix follows existing pointer-handling behavior, and the regression tests cover the reported failures with no unresolved issues.

No open issues 🎉

What changed in this PR

Fixes MoveOperation source-location helpers so they accept JsonPointer objects consistently with apply().

Changes:

  • Reuses _from_pointer() when reading or updating source-location parts.
  • Adds regressions for standard and custom pointer classes, including applying a move after editing its source.
File Description
tests.py Adds pointer-object regression tests for source-location helpers.
jsonpatch.py Uses existing pointer handling in three source-location helpers.

Review effort: Balanced

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 100.0%. remained the same — ice-pring:fix/from-pointer-location-helpers into stefankoegl:master

@stefankoegl
stefankoegl merged commit 7fe5c3a into stefankoegl:master Oct 24, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants