예제 #1
0
def test_removal_of_the_subkey():
    patch = Patch()
    patch['xyz'] = {'abc': None}
    jsonpatch = patch.as_json_patch()
    assert jsonpatch == [
        {
            'op': 'remove',
            'path': '/xyz/abc'
        },
    ]
예제 #2
0
def test_removal_of_the_key():
    patch = Patch()
    patch['xyz'] = None
    jsonpatch = patch.as_json_patch()
    assert jsonpatch == [
        {
            'op': 'remove',
            'path': '/xyz'
        },
    ]
예제 #3
0
def test_addition_of_the_key():
    patch = Patch()
    patch['xyz'] = 123
    jsonpatch = patch.as_json_patch()
    assert jsonpatch == [
        {
            'op': 'replace',
            'path': '/xyz',
            'value': 123
        },
    ]