def testPatch(self): a = {'hello': 'there', 'done': None} b = {'hello': 'hola', 'tank': False, 'gas': 8} patch = diff.diff_structures(a, b) self.assertEquals(b, diff.patch(a, patch)) a = ['hello'] b = ['hola', False, None] patch = diff.diff_structures(a, b) self.assertEquals(b, diff.patch(a, patch))
def testPatchEmpty(self): a = {'hello': 'there'} self.assertEquals(a, diff.patch(a, {})) self.assertEquals(a, diff.patch(a, {'+':{}, '*':{}, '-':[]}))
def testPatchNested(self): a = {'a': {'b': {'c': 7}}} b = {'a': {'b': {'d': 7}}} patch = diff.diff_structures(a, b) self.assertEquals(b, diff.patch(a, patch))