-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try to be more helpful when someone forgets a slash in JSON pointers.
- Loading branch information
Showing
4 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ autodetecting | |
boolean | ||
changelog | ||
deduplication | ||
dereferenced | ||
deserialized | ||
discoverability | ||
filesystem | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -738,6 +738,23 @@ def test_lookup_non_existent_anchor(self): | |
anchor="noSuchAnchor", | ||
) | ||
|
||
def test_lookup_invalid_JSON_pointerish_anchor(self): | ||
resolver = Registry().resolver_with_root( | ||
ID_AND_CHILDREN.create_resource( | ||
{ | ||
"ID": "http://example.com/", | ||
"foo": {"bar": 12}, | ||
}, | ||
), | ||
) | ||
|
||
valid = resolver.lookup("#/foo/bar") | ||
assert valid.contents == 12 | ||
|
||
with pytest.raises(exceptions.InvalidAnchor) as e: | ||
This comment has been minimized.
Sorry, something went wrong.
ikonst
|
||
resolver.lookup("#foo/bar") | ||
assert " '#/foo/bar'" in str(e.value) | ||
|
||
def test_lookup_retrieved_resource(self): | ||
resource = Resource.opaque(contents={"foo": "baz"}) | ||
resolver = Registry(retrieve=lambda uri: resource).resolver() | ||
|
Seeing that at the call site
shouldn't this be
?