jsonpointer 2.3__tar.gz → 3.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {jsonpointer-2.3/jsonpointer.egg-info → jsonpointer-3.0.0}/PKG-INFO +5 -10
- {jsonpointer-2.3 → jsonpointer-3.0.0}/README.md +0 -1
- {jsonpointer-2.3 → jsonpointer-3.0.0}/bin/jsonpointer +4 -6
- {jsonpointer-2.3 → jsonpointer-3.0.0/jsonpointer.egg-info}/PKG-INFO +5 -10
- {jsonpointer-2.3 → jsonpointer-3.0.0}/jsonpointer.py +14 -32
- jsonpointer-3.0.0/setup.cfg +11 -0
- {jsonpointer-2.3 → jsonpointer-3.0.0}/setup.py +10 -12
- {jsonpointer-2.3 → jsonpointer-3.0.0}/tests.py +15 -36
- jsonpointer-2.3/setup.cfg +0 -7
- {jsonpointer-2.3 → jsonpointer-3.0.0}/AUTHORS +0 -0
- {jsonpointer-2.3 → jsonpointer-3.0.0}/LICENSE.txt +0 -0
- {jsonpointer-2.3 → jsonpointer-3.0.0}/MANIFEST.in +0 -0
- {jsonpointer-2.3 → jsonpointer-3.0.0}/jsonpointer.egg-info/SOURCES.txt +0 -0
- {jsonpointer-2.3 → jsonpointer-3.0.0}/jsonpointer.egg-info/dependency_links.txt +0 -0
- {jsonpointer-2.3 → jsonpointer-3.0.0}/jsonpointer.egg-info/top_level.txt +0 -0
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: jsonpointer
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0
|
|
4
4
|
Summary: Identify specific nodes in a JSON document (RFC 6901)
|
|
5
5
|
Home-page: https://github.com/stefankoegl/python-json-pointer
|
|
6
6
|
Author: Stefan Kögl
|
|
7
7
|
Author-email: stefan@skoegl.net
|
|
8
8
|
License: Modified BSD License
|
|
9
|
-
Platform: UNKNOWN
|
|
10
9
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
10
|
Classifier: Environment :: Console
|
|
12
11
|
Classifier: Intended Audience :: Developers
|
|
13
12
|
Classifier: License :: OSI Approved :: BSD License
|
|
14
13
|
Classifier: Operating System :: OS Independent
|
|
15
14
|
Classifier: Programming Language :: Python
|
|
16
|
-
Classifier: Programming Language :: Python :: 2
|
|
17
|
-
Classifier: Programming Language :: Python :: 2.7
|
|
18
15
|
Classifier: Programming Language :: Python :: 3
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.5
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
21
16
|
Classifier: Programming Language :: Python :: 3.7
|
|
22
17
|
Classifier: Programming Language :: Python :: 3.8
|
|
23
18
|
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
22
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
25
23
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
26
24
|
Classifier: Topic :: Software Development :: Libraries
|
|
27
25
|
Classifier: Topic :: Utilities
|
|
28
|
-
Requires-Python: >=
|
|
26
|
+
Requires-Python: >=3.7
|
|
29
27
|
Description-Content-Type: text/markdown
|
|
30
28
|
License-File: LICENSE.txt
|
|
31
29
|
License-File: AUTHORS
|
|
@@ -35,7 +33,6 @@ python-json-pointer
|
|
|
35
33
|
|
|
36
34
|
[](https://pypi.python.org/pypi/jsonpointer/)
|
|
37
35
|
[](https://pypi.python.org/pypi/jsonpointer/)
|
|
38
|
-
[](https://travis-ci.org/stefankoegl/python-json-pointer)
|
|
39
36
|
[](https://coveralls.io/r/stefankoegl/python-json-pointer?branch=master)
|
|
40
37
|
|
|
41
38
|
|
|
@@ -52,5 +49,3 @@ See source code for examples
|
|
|
52
49
|
* PyPI: https://pypi.python.org/pypi/jsonpointer
|
|
53
50
|
* Travis CI: https://travis-ci.org/stefankoegl/python-json-pointer
|
|
54
51
|
* Coveralls: https://coveralls.io/r/stefankoegl/python-json-pointer
|
|
55
|
-
|
|
56
|
-
|
|
@@ -3,7 +3,6 @@ python-json-pointer
|
|
|
3
3
|
|
|
4
4
|
[](https://pypi.python.org/pypi/jsonpointer/)
|
|
5
5
|
[](https://pypi.python.org/pypi/jsonpointer/)
|
|
6
|
-
[](https://travis-ci.org/stefankoegl/python-json-pointer)
|
|
7
6
|
[](https://coveralls.io/r/stefankoegl/python-json-pointer?branch=master)
|
|
8
7
|
|
|
9
8
|
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
|
-
from __future__ import print_function
|
|
5
4
|
|
|
6
|
-
import sys
|
|
7
|
-
import os.path
|
|
8
|
-
import json
|
|
9
|
-
import jsonpointer
|
|
10
5
|
import argparse
|
|
6
|
+
import json
|
|
7
|
+
import sys
|
|
11
8
|
|
|
9
|
+
import jsonpointer
|
|
12
10
|
|
|
13
11
|
parser = argparse.ArgumentParser(
|
|
14
12
|
description='Resolve a JSON pointer on JSON files')
|
|
@@ -20,7 +18,7 @@ ptr_group.add_argument('-f', '--pointer-file', type=argparse.FileType('r'),
|
|
|
20
18
|
nargs='?',
|
|
21
19
|
help='File containing a JSON pointer expression')
|
|
22
20
|
|
|
23
|
-
ptr_group.add_argument('POINTER',
|
|
21
|
+
ptr_group.add_argument('POINTER', type=str, nargs='?',
|
|
24
22
|
help='A JSON pointer expression')
|
|
25
23
|
|
|
26
24
|
parser.add_argument('FILE', type=argparse.FileType('r'), nargs='+',
|
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: jsonpointer
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0
|
|
4
4
|
Summary: Identify specific nodes in a JSON document (RFC 6901)
|
|
5
5
|
Home-page: https://github.com/stefankoegl/python-json-pointer
|
|
6
6
|
Author: Stefan Kögl
|
|
7
7
|
Author-email: stefan@skoegl.net
|
|
8
8
|
License: Modified BSD License
|
|
9
|
-
Platform: UNKNOWN
|
|
10
9
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
10
|
Classifier: Environment :: Console
|
|
12
11
|
Classifier: Intended Audience :: Developers
|
|
13
12
|
Classifier: License :: OSI Approved :: BSD License
|
|
14
13
|
Classifier: Operating System :: OS Independent
|
|
15
14
|
Classifier: Programming Language :: Python
|
|
16
|
-
Classifier: Programming Language :: Python :: 2
|
|
17
|
-
Classifier: Programming Language :: Python :: 2.7
|
|
18
15
|
Classifier: Programming Language :: Python :: 3
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.5
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
21
16
|
Classifier: Programming Language :: Python :: 3.7
|
|
22
17
|
Classifier: Programming Language :: Python :: 3.8
|
|
23
18
|
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
22
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
25
23
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
26
24
|
Classifier: Topic :: Software Development :: Libraries
|
|
27
25
|
Classifier: Topic :: Utilities
|
|
28
|
-
Requires-Python: >=
|
|
26
|
+
Requires-Python: >=3.7
|
|
29
27
|
Description-Content-Type: text/markdown
|
|
30
28
|
License-File: LICENSE.txt
|
|
31
29
|
License-File: AUTHORS
|
|
@@ -35,7 +33,6 @@ python-json-pointer
|
|
|
35
33
|
|
|
36
34
|
[](https://pypi.python.org/pypi/jsonpointer/)
|
|
37
35
|
[](https://pypi.python.org/pypi/jsonpointer/)
|
|
38
|
-
[](https://travis-ci.org/stefankoegl/python-json-pointer)
|
|
39
36
|
[](https://coveralls.io/r/stefankoegl/python-json-pointer?branch=master)
|
|
40
37
|
|
|
41
38
|
|
|
@@ -52,5 +49,3 @@ See source code for examples
|
|
|
52
49
|
* PyPI: https://pypi.python.org/pypi/jsonpointer
|
|
53
50
|
* Travis CI: https://travis-ci.org/stefankoegl/python-json-pointer
|
|
54
51
|
* Coveralls: https://coveralls.io/r/stefankoegl/python-json-pointer
|
|
55
|
-
|
|
56
|
-
|
|
@@ -32,38 +32,22 @@
|
|
|
32
32
|
|
|
33
33
|
""" Identify specific nodes in a JSON document (RFC 6901) """
|
|
34
34
|
|
|
35
|
-
from __future__ import unicode_literals
|
|
36
|
-
|
|
37
35
|
# Will be parsed by setup.py to determine package metadata
|
|
38
36
|
__author__ = 'Stefan Kögl <stefan@skoegl.net>'
|
|
39
|
-
__version__ = '
|
|
37
|
+
__version__ = '3.0.0'
|
|
40
38
|
__website__ = 'https://github.com/stefankoegl/python-json-pointer'
|
|
41
39
|
__license__ = 'Modified BSD License'
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
try:
|
|
45
|
-
from itertools import izip
|
|
46
|
-
str = unicode
|
|
47
|
-
encode_str = lambda u: u.encode("raw_unicode_escape")
|
|
48
|
-
except ImportError: # Python 3
|
|
49
|
-
izip = zip
|
|
50
|
-
encode_str = lambda u: u
|
|
51
|
-
|
|
52
|
-
try:
|
|
53
|
-
from collections.abc import Mapping, Sequence
|
|
54
|
-
except ImportError: # Python 3
|
|
55
|
-
from collections import Mapping, Sequence
|
|
56
|
-
|
|
57
|
-
from itertools import tee, chain
|
|
58
|
-
import re
|
|
59
41
|
import copy
|
|
60
|
-
|
|
42
|
+
import re
|
|
43
|
+
from collections.abc import Mapping, Sequence
|
|
44
|
+
from itertools import tee, chain
|
|
61
45
|
|
|
62
46
|
_nothing = object()
|
|
63
47
|
|
|
64
48
|
|
|
65
49
|
def set_pointer(doc, pointer, value, inplace=True):
|
|
66
|
-
"""Resolves pointer against doc and sets the value of the target within doc.
|
|
50
|
+
"""Resolves a pointer against doc and sets the value of the target within doc.
|
|
67
51
|
|
|
68
52
|
With inplace set to true, doc is modified as long as pointer is not the
|
|
69
53
|
root.
|
|
@@ -145,7 +129,7 @@ def pairwise(iterable):
|
|
|
145
129
|
a, b = tee(iterable)
|
|
146
130
|
for _ in b:
|
|
147
131
|
break
|
|
148
|
-
return
|
|
132
|
+
return zip(a, b)
|
|
149
133
|
|
|
150
134
|
|
|
151
135
|
class JsonPointerException(Exception):
|
|
@@ -259,12 +243,11 @@ class JsonPointer(object):
|
|
|
259
243
|
else:
|
|
260
244
|
raise JsonPointerException("Document '%s' does not support indexing, "
|
|
261
245
|
"must be mapping/sequence or support __getitem__" % type(doc))
|
|
262
|
-
|
|
246
|
+
|
|
263
247
|
def get_parts(self):
|
|
264
248
|
"""Returns the list of the parts. For example, JsonPointer('/a/b').get_parts() == ['a', 'b']"""
|
|
265
|
-
|
|
266
|
-
return self.parts
|
|
267
249
|
|
|
250
|
+
return self.parts
|
|
268
251
|
|
|
269
252
|
def walk(self, doc, part):
|
|
270
253
|
""" Walks one step in doc and returns the referenced part """
|
|
@@ -281,7 +264,7 @@ class JsonPointer(object):
|
|
|
281
264
|
return doc[part]
|
|
282
265
|
|
|
283
266
|
except IndexError:
|
|
284
|
-
raise JsonPointerException("index '%s' is out of bounds" % (part,
|
|
267
|
+
raise JsonPointerException("index '%s' is out of bounds" % (part,))
|
|
285
268
|
|
|
286
269
|
# Else the object is a mapping or supports __getitem__(so assume custom indexing)
|
|
287
270
|
try:
|
|
@@ -290,7 +273,6 @@ class JsonPointer(object):
|
|
|
290
273
|
except KeyError:
|
|
291
274
|
raise JsonPointerException("member '%s' not found in %s" % (part, doc))
|
|
292
275
|
|
|
293
|
-
|
|
294
276
|
def contains(self, ptr):
|
|
295
277
|
""" Returns True if self contains the given ptr """
|
|
296
278
|
return self.parts[:len(ptr.parts)] == ptr.parts
|
|
@@ -309,12 +291,11 @@ class JsonPointer(object):
|
|
|
309
291
|
suffix_parts = suffix
|
|
310
292
|
try:
|
|
311
293
|
return JsonPointer.from_parts(chain(self.parts, suffix_parts))
|
|
312
|
-
except:
|
|
294
|
+
except: # noqa E722
|
|
313
295
|
raise JsonPointerException("Invalid suffix")
|
|
314
296
|
|
|
315
|
-
def __truediv__(self, suffix):
|
|
297
|
+
def __truediv__(self, suffix): # Python 3
|
|
316
298
|
return self.join(suffix)
|
|
317
|
-
__div__ = __truediv__ # Python 2
|
|
318
299
|
|
|
319
300
|
@property
|
|
320
301
|
def path(self):
|
|
@@ -342,10 +323,10 @@ class JsonPointer(object):
|
|
|
342
323
|
return hash(tuple(self.parts))
|
|
343
324
|
|
|
344
325
|
def __str__(self):
|
|
345
|
-
return
|
|
326
|
+
return self.path
|
|
346
327
|
|
|
347
328
|
def __repr__(self):
|
|
348
|
-
return "
|
|
329
|
+
return type(self).__name__ + "(" + repr(self.path) + ")"
|
|
349
330
|
|
|
350
331
|
@classmethod
|
|
351
332
|
def from_parts(cls, parts):
|
|
@@ -362,5 +343,6 @@ class JsonPointer(object):
|
|
|
362
343
|
def escape(s):
|
|
363
344
|
return s.replace('~', '~0').replace('/', '~1')
|
|
364
345
|
|
|
346
|
+
|
|
365
347
|
def unescape(s):
|
|
366
348
|
return s.replace('~1', '/').replace('~0', '~')
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
|
|
3
|
-
from setuptools import setup
|
|
4
|
-
import re
|
|
5
3
|
import io
|
|
6
4
|
import os.path
|
|
5
|
+
import re
|
|
6
|
+
|
|
7
|
+
from setuptools import setup
|
|
7
8
|
|
|
8
9
|
dirname = os.path.dirname(os.path.abspath(__file__))
|
|
9
10
|
filename = os.path.join(dirname, 'jsonpointer.py')
|
|
@@ -14,7 +15,7 @@ docstrings = re.findall('"""(.*)"""', src)
|
|
|
14
15
|
PACKAGE = 'jsonpointer'
|
|
15
16
|
|
|
16
17
|
MODULES = (
|
|
17
|
-
|
|
18
|
+
'jsonpointer',
|
|
18
19
|
)
|
|
19
20
|
|
|
20
21
|
AUTHOR_EMAIL = metadata['author']
|
|
@@ -26,10 +27,8 @@ DESCRIPTION = docstrings[0]
|
|
|
26
27
|
# Extract name and e-mail ("Firstname Lastname <mail@example.org>")
|
|
27
28
|
AUTHOR, EMAIL = re.match(r'(.*) <(.*)>', AUTHOR_EMAIL).groups()
|
|
28
29
|
|
|
29
|
-
|
|
30
30
|
with open('README.md') as readme:
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
long_description = readme.read()
|
|
33
32
|
|
|
34
33
|
CLASSIFIERS = [
|
|
35
34
|
'Development Status :: 5 - Production/Stable',
|
|
@@ -38,14 +37,13 @@ CLASSIFIERS = [
|
|
|
38
37
|
'License :: OSI Approved :: BSD License',
|
|
39
38
|
'Operating System :: OS Independent',
|
|
40
39
|
'Programming Language :: Python',
|
|
41
|
-
'Programming Language :: Python :: 2',
|
|
42
|
-
'Programming Language :: Python :: 2.7',
|
|
43
40
|
'Programming Language :: Python :: 3',
|
|
44
|
-
'Programming Language :: Python :: 3.5',
|
|
45
|
-
'Programming Language :: Python :: 3.6',
|
|
46
41
|
'Programming Language :: Python :: 3.7',
|
|
47
42
|
'Programming Language :: Python :: 3.8',
|
|
48
43
|
'Programming Language :: Python :: 3.9',
|
|
44
|
+
'Programming Language :: Python :: 3.10',
|
|
45
|
+
'Programming Language :: Python :: 3.11',
|
|
46
|
+
'Programming Language :: Python :: 3.12',
|
|
49
47
|
'Programming Language :: Python :: Implementation :: CPython',
|
|
50
48
|
'Programming Language :: Python :: Implementation :: PyPy',
|
|
51
49
|
'Topic :: Software Development :: Libraries',
|
|
@@ -64,5 +62,5 @@ setup(name=PACKAGE,
|
|
|
64
62
|
py_modules=MODULES,
|
|
65
63
|
scripts=['bin/jsonpointer'],
|
|
66
64
|
classifiers=CLASSIFIERS,
|
|
67
|
-
python_requires='>=
|
|
68
|
-
)
|
|
65
|
+
python_requires='>=3.7',
|
|
66
|
+
)
|
|
@@ -3,19 +3,21 @@
|
|
|
3
3
|
|
|
4
4
|
from __future__ import unicode_literals
|
|
5
5
|
|
|
6
|
+
import copy
|
|
6
7
|
import doctest
|
|
7
|
-
import unittest
|
|
8
8
|
import sys
|
|
9
|
-
import
|
|
9
|
+
import unittest
|
|
10
|
+
|
|
11
|
+
import jsonpointer
|
|
10
12
|
from jsonpointer import resolve_pointer, EndOfList, JsonPointerException, \
|
|
11
|
-
|
|
13
|
+
JsonPointer, set_pointer
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
class SpecificationTests(unittest.TestCase):
|
|
15
17
|
""" Tests all examples from the JSON Pointer specification """
|
|
16
18
|
|
|
17
19
|
def test_example(self):
|
|
18
|
-
doc =
|
|
20
|
+
doc = {
|
|
19
21
|
"foo": ["bar", "baz"],
|
|
20
22
|
"": 0,
|
|
21
23
|
"a/b": 1,
|
|
@@ -41,7 +43,6 @@ class SpecificationTests(unittest.TestCase):
|
|
|
41
43
|
self.assertEqual(resolve_pointer(doc, "/ "), 7)
|
|
42
44
|
self.assertEqual(resolve_pointer(doc, "/m~0n"), 8)
|
|
43
45
|
|
|
44
|
-
|
|
45
46
|
def test_eol(self):
|
|
46
47
|
doc = {
|
|
47
48
|
"foo": ["bar", "baz"]
|
|
@@ -164,19 +165,16 @@ class ComparisonTests(unittest.TestCase):
|
|
|
164
165
|
self.assertFalse(p1 == "/something/1/b")
|
|
165
166
|
|
|
166
167
|
def test_contains(self):
|
|
167
|
-
|
|
168
168
|
self.assertTrue(self.ptr1.contains(self.ptr2))
|
|
169
169
|
self.assertTrue(self.ptr1.contains(self.ptr1))
|
|
170
170
|
self.assertFalse(self.ptr1.contains(self.ptr3))
|
|
171
171
|
|
|
172
172
|
def test_contains_magic(self):
|
|
173
|
-
|
|
174
173
|
self.assertTrue(self.ptr2 in self.ptr1)
|
|
175
174
|
self.assertTrue(self.ptr1 in self.ptr1)
|
|
176
175
|
self.assertFalse(self.ptr3 in self.ptr1)
|
|
177
176
|
|
|
178
177
|
def test_join(self):
|
|
179
|
-
|
|
180
178
|
ptr12a = self.ptr1.join(self.ptr2)
|
|
181
179
|
self.assertEqual(ptr12a.path, "/a/b/c/a/b")
|
|
182
180
|
|
|
@@ -195,7 +193,6 @@ class ComparisonTests(unittest.TestCase):
|
|
|
195
193
|
self.assertRaises(JsonPointerException, self.ptr1.join, 0)
|
|
196
194
|
|
|
197
195
|
def test_join_magic(self):
|
|
198
|
-
|
|
199
196
|
ptr12a = self.ptr1 / self.ptr2
|
|
200
197
|
self.assertEqual(ptr12a.path, "/a/b/c/a/b")
|
|
201
198
|
|
|
@@ -211,6 +208,7 @@ class ComparisonTests(unittest.TestCase):
|
|
|
211
208
|
ptr12e = self.ptr1 / ["a", "b"]
|
|
212
209
|
self.assertEqual(ptr12e.path, "/a/b/c/a/b")
|
|
213
210
|
|
|
211
|
+
|
|
214
212
|
class WrongInputTests(unittest.TestCase):
|
|
215
213
|
|
|
216
214
|
def test_no_start_slash(self):
|
|
@@ -243,7 +241,6 @@ class ToLastTests(unittest.TestCase):
|
|
|
243
241
|
self.assertEqual(doc, last)
|
|
244
242
|
self.assertTrue(nxt is None)
|
|
245
243
|
|
|
246
|
-
|
|
247
244
|
def test_path(self):
|
|
248
245
|
doc = {'a': [{'b': 1, 'c': 2}, 5]}
|
|
249
246
|
ptr = JsonPointer('/a/0/b')
|
|
@@ -255,7 +252,7 @@ class ToLastTests(unittest.TestCase):
|
|
|
255
252
|
class SetTests(unittest.TestCase):
|
|
256
253
|
|
|
257
254
|
def test_set(self):
|
|
258
|
-
doc =
|
|
255
|
+
doc = {
|
|
259
256
|
"foo": ["bar", "baz"],
|
|
260
257
|
"": 0,
|
|
261
258
|
"a/b": 1,
|
|
@@ -284,7 +281,7 @@ class SetTests(unittest.TestCase):
|
|
|
284
281
|
|
|
285
282
|
newdoc = set_pointer(doc, "/fud", {}, inplace=False)
|
|
286
283
|
newdoc = set_pointer(newdoc, "/fud/gaw", [1, 2, 3], inplace=False)
|
|
287
|
-
self.assertEqual(resolve_pointer(newdoc, "/fud"), {'gaw'
|
|
284
|
+
self.assertEqual(resolve_pointer(newdoc, "/fud"), {'gaw': [1, 2, 3]})
|
|
288
285
|
|
|
289
286
|
newdoc = set_pointer(doc, "", 9, inplace=False)
|
|
290
287
|
self.assertEqual(newdoc, 9)
|
|
@@ -306,14 +303,13 @@ class SetTests(unittest.TestCase):
|
|
|
306
303
|
self.assertRaises(JsonPointerException, set_pointer, doc, "/fud/gaw", 9)
|
|
307
304
|
|
|
308
305
|
set_pointer(doc, "/fud", {})
|
|
309
|
-
set_pointer(doc, "/fud/gaw", [1, 2, 3]
|
|
310
|
-
self.assertEqual(resolve_pointer(doc, "/fud"), {'gaw'
|
|
306
|
+
set_pointer(doc, "/fud/gaw", [1, 2, 3])
|
|
307
|
+
self.assertEqual(resolve_pointer(doc, "/fud"), {'gaw': [1, 2, 3]})
|
|
311
308
|
|
|
312
309
|
self.assertRaises(JsonPointerException, set_pointer, doc, "", 9)
|
|
313
310
|
|
|
314
311
|
|
|
315
312
|
class AltTypesTests(unittest.TestCase):
|
|
316
|
-
|
|
317
313
|
class Node(object):
|
|
318
314
|
def __init__(self, name, parent=None):
|
|
319
315
|
self.name = name
|
|
@@ -348,13 +344,13 @@ class AltTypesTests(unittest.TestCase):
|
|
|
348
344
|
class mdict(object):
|
|
349
345
|
def __init__(self, d):
|
|
350
346
|
self._d = d
|
|
347
|
+
|
|
351
348
|
def __getitem__(self, item):
|
|
352
349
|
return self._d[item]
|
|
353
350
|
|
|
354
351
|
mdict = mdict({'root': {'1': {'2': '3'}}})
|
|
355
352
|
Node = Node
|
|
356
353
|
|
|
357
|
-
|
|
358
354
|
def test_alttypes(self):
|
|
359
355
|
Node = self.Node
|
|
360
356
|
|
|
@@ -410,23 +406,6 @@ class AltTypesTests(unittest.TestCase):
|
|
|
410
406
|
self.assertRaises(JsonPointerException, resolve_pointer, doc, '/root/1/2/3/4')
|
|
411
407
|
|
|
412
408
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
suite.addTest(unittest.makeSuite(ComparisonTests))
|
|
417
|
-
suite.addTest(unittest.makeSuite(WrongInputTests))
|
|
418
|
-
suite.addTest(unittest.makeSuite(ToLastTests))
|
|
419
|
-
suite.addTest(unittest.makeSuite(SetTests))
|
|
420
|
-
suite.addTest(unittest.makeSuite(AltTypesTests))
|
|
421
|
-
|
|
422
|
-
modules = ['jsonpointer']
|
|
423
|
-
|
|
424
|
-
for module in modules:
|
|
425
|
-
m = __import__(module, fromlist=[module])
|
|
426
|
-
suite.addTest(doctest.DocTestSuite(m))
|
|
427
|
-
|
|
428
|
-
runner = unittest.TextTestRunner(verbosity=1)
|
|
429
|
-
result = runner.run(suite)
|
|
430
|
-
|
|
431
|
-
if not result.wasSuccessful():
|
|
432
|
-
sys.exit(1)
|
|
409
|
+
def load_tests(loader, tests, ignore):
|
|
410
|
+
tests.addTests(doctest.DocTestSuite(jsonpointer))
|
|
411
|
+
return tests
|
jsonpointer-2.3/setup.cfg
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|