def test_remove_type_error(): node = {'key': 'value'} with pytest.raises(TypeError): remove(node, 'key')
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]
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]
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]