Exemplo n.º 1
0
    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))
Exemplo n.º 2
0
 def testPatchEmpty(self):
     a = {'hello': 'there'}
     self.assertEquals(a, diff.patch(a, {}))
     self.assertEquals(a, diff.patch(a, {'+':{}, '*':{}, '-':[]}))
Exemplo n.º 3
0
 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))