예제 #1
0
def test_remove_type_error():
    node = {'key': 'value'}
    with pytest.raises(TypeError):
        remove(node, 'key')
예제 #2
0
def test_object_remove(obj):
    new = remove(obj, 'key')
    assert obj is not new
    assert set(new.keys()) == set(obj.keys()) - set(['key'])
    for key in new.keys():
        assert obj[key] is new[key]
예제 #3
0
def test_array_remove(array):
    new = remove(array, 1)
    assert array is not new
    assert len(new) == len(array) - 1
    assert new[0] is array[0]
    assert new[1] is array[2]
예제 #4
0
def test_document_remove(doc):
    new = remove(doc, 'integer')
    assert doc is not new
    assert set(new.keys()) == set(doc.keys()) - set(['integer'])
    for key in new.keys():
        assert doc[key] is new[key]