dictdiffer
dictdiffer copied to clipboard
Unifier class: `unify` method returns duplicated patches
Unifier class: unify method returns a list containing duplicated patches in the case of conflicts containing equal patches (same path).
e.g.
patch1 = ('remove', '', [('a', 'b')])
patch2 = ('remove', '', [('a', 'b')])
conflicts = Conflict(patch1, patch2)
conflicts.take = 'f' # can be 's' too
The result of calling u.unify([patch1], [patch2], [conflicts]) will be [patch1, patch2] instead of [patch1]. This particular case can lead to KeyErrors in case of calling patch, as it will try to remove the same key twice. The second time it fails as the key has already been deleted.