File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 44import copy
55import doctest
66import unittest
7+ from collections import OrderedDict
78
89import jsonpointer
910from jsonpointer import resolve_pointer , EndOfList , JsonPointerException , \
@@ -216,6 +217,24 @@ def test_trailing_escape(self):
216217 def test_invalid_escape (self ):
217218 self .assertRaises (JsonPointerException , JsonPointer , '/foo/bar~2' )
218219
220+ def test_ordereddict_member_not_found (self ):
221+ # Resolving a pointer to a non-existent key in an OrderedDict should
222+ # raise JsonPointerException (not a bare KeyError or any other exception)
223+ doc = OrderedDict ([
224+ ('$schema' , 'http://json-schema.org/draft-07/schema#' ),
225+ ('$id' , '/sports_field' ),
226+ ('title' , 'Field' ),
227+ ('description' , 'A sports field description.' ),
228+ ('type' , 'object' ),
229+ ('properties' , OrderedDict ([
230+ ('description' , OrderedDict ([
231+ ('description' , 'Field description' ),
232+ ('type' , 'string' ),
233+ ])),
234+ ])),
235+ ])
236+ self .assertRaises (JsonPointerException , resolve_pointer , doc , '/src' )
237+
219238
220239class ToLastTests (unittest .TestCase ):
221240
You can’t perform that action at this time.
0 commit comments