rows = {row['id']: copy.deepcopy(row) for row in data['rows']}
original = copy.deepcopy(rows)
check('预演前后没有直接写入', rows == original)
changes = output['changes']
check('只建议清理确实有空格的R2', len(changes) == 1 and changes[0]['id'] == 'R2' and changes[0]['field'] == 'city' and changes[0]['after'] == '深圳')
for change in changes:
    if change['id'] == 'R2' and change['field'] == 'city' and change['before'] == rows['R2']['city']:
        rows['R2']['city'] = change['after']
check('批准写入只改变R2，行数保持2', rows['R1'] == original['R1'] and rows['R2']['city'] == '深圳' and len(rows) == 2)
save_csv(folder / 'approved.csv', list(rows.values()))
result = {'proposed': output, 'after_local_approval': list(rows.values()), 'deleted': 0}
