Exemplo n.º 1
0
 def test_patch_has_no_side_effects(self):
     a = [1, 2, 3]
     copy_of_a = deepcopy(a)
     b = [3, 2, 1]
     d = diff(a, b)
     self.assertEqual(patch_sequence(a, d), b)
     self.assertEqual(a, copy_of_a)
Exemplo n.º 2
0
 def test_another_different_object_case(self):
     a = [0, 0, 0]
     b = [0, 1, 0, 1, 0]
     c = [2, 2, 2]
     d = diff(a, b)
     self.assertEqual(patch_sequence(c, d), [2, 1, 2, 1, 2])
Exemplo n.º 3
0
 def test_can_apply_patch_to_different_object(self):
     a = [0, 1, 2, 3]
     b = [1, 2, 3, 4]
     c = [0, 2, 2, 2]
     d = diff(a, b)
     self.assertEqual(patch_sequence(c, d), [2, 2, 2, 4])