Пример #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))
Пример #2
0
 def testPatchEmpty(self):
     a = {'hello': 'there'}
     self.assertEquals(a, diff.patch(a, {}))
     self.assertEquals(a, diff.patch(a, {'+':{}, '*':{}, '-':[]}))
Пример #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))