From 28514fd7d4ddbacba97b98625c79f54f52aaec62 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 3 Nov 2026 13:29:39 +0000 Subject: [PATCH] Add JsonPatchPathNotFound to the type stubs stubtest failed on master because the exception added in #250 was missing from jsonpatch-stubs/__init__.pyi. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01PewzpjGk8XUYuEdhG8sXSD --- jsonpatch-stubs/__init__.pyi | 1 + typetests/usage.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/jsonpatch-stubs/__init__.pyi b/jsonpatch-stubs/__init__.pyi index 1fad29e..efd78cc 100644 --- a/jsonpatch-stubs/__init__.pyi +++ b/jsonpatch-stubs/__init__.pyi @@ -35,6 +35,7 @@ class JsonPatchException(Exception): class InvalidJsonPatch(JsonPatchException): ... class JsonPatchConflict(JsonPatchException): ... +class JsonPatchPathNotFound(JsonPatchConflict): ... class JsonPatchTestFailed(JsonPatchException, AssertionError): ... def multidict(ordered_pairs: Iterable[tuple[str, Any]]) -> dict[str, Any]: ... diff --git a/typetests/usage.py b/typetests/usage.py index 4b02bb9..c2546d0 100644 --- a/typetests/usage.py +++ b/typetests/usage.py @@ -17,7 +17,8 @@ import jsonpatch from jsonpatch import (InvalidJsonPatch, JsonPatch, JsonPatchConflict, - JsonPatchException, JsonPatchTestFailed, + JsonPatchException, JsonPatchPathNotFound, + JsonPatchTestFailed, PatchOperation) doc = {'foo': 'bar'} @@ -85,6 +86,11 @@ class MyPointer(JsonPointer): assert_type(ex, InvalidJsonPatch | JsonPatchConflict | JsonPatchTestFailed) failed = ex.op JsonPatchException('message', op=None) +try: + patch.apply(doc) +except JsonPatchPathNotFound as ex: + assert_type(ex, JsonPatchPathNotFound) + conflict: JsonPatchConflict = ex # names that jsonpatch re-exports from jsonpointer try: