Skip to content

Optimizations from #16 reverted #21

Open
@stefankoegl

Description

@stefankoegl

I had to revert the optimizations from #16, because the tests of jsonpatch failed with

$ ./tests.py 
........E.......E...................................................................
======================================================================
ERROR: test_append (__main__.ApplyPatchTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./tests.py", line 218, in test_append
    {'op': 'add', 'path': '/foo/-', 'value': 4},
  File "/home/stefan/python-json-patch/jsonpatch.py", line 154, in apply_patch
    return patch.apply(doc, in_place)
  File "/home/stefan/python-json-patch/jsonpatch.py", line 364, in apply
    obj = operation.apply(obj)
  File "/home/stefan/python-json-patch/jsonpatch.py", line 438, in apply
    elif part > len(subobj) or part < 0:
TypeError: unorderable types: EndOfList() > int()

======================================================================
ERROR: test_js_file (__main__.ApplyPatchTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./tests.py", line 23, in test_js_file
    result = jsonpatch.apply_patch(test['doc'], test['patch'])
  File "/home/stefan/python-json-patch/jsonpatch.py", line 154, in apply_patch
    return patch.apply(doc, in_place)
  File "/home/stefan/python-json-patch/jsonpatch.py", line 364, in apply
    obj = operation.apply(obj)
  File "/home/stefan/python-json-patch/jsonpatch.py", line 438, in apply
    elif part > len(subobj) or part < 0:
TypeError: unorderable types: EndOfList() > int()

----------------------------------------------------------------------
Ran 84 tests in 0.019s

FAILED (errors=2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions