Exemplo n.º 1
0
 def test_getopcodes(self):
     old = 'I have a string to change'
     new = 'We have a string to change now'
     codes = treediff.get_opcodes(old, new)
     self.assertEquals(
         [
             [('delete', 0, 1), ('insert', 0, 'We')],
             ('insert', 25, ' now')], codes)
Exemplo n.º 2
0
 def test_ins_opcodes_trailing_space(self):
     old = 'Howdy howdy. '
     new = 'Howdy howdy. More content'
     codes = treediff.get_opcodes(old, new)
     self.assertEquals(
         [('insert', 13, 'More content')], codes)
Exemplo n.º 3
0
 def test_del_opcodes_middle(self):
     old = "I have a string to change"
     new = 'I have a change'
     codes = treediff.get_opcodes(old, new)
     self.assertEquals(
         [('delete', 9, 19)], codes)
Exemplo n.º 4
0
 def test_ins_opcodes(self):
     old = "I a string to change"
     new = "I have a string to change"
     codes = treediff.get_opcodes(old, new)
     self.assertEquals(
         [('insert', 2, 'have ')], codes)
Exemplo n.º 5
0
 def test_ins_opcodes_trailing_space(self):
     old = 'Howdy howdy. '
     new = 'Howdy howdy. More content'
     codes = treediff.get_opcodes(old, new)
     self.assertEquals([('insert', 13, 'More content')], codes)
Exemplo n.º 6
0
 def test_del_opcodes_middle(self):
     old = "I have a string to change"
     new = 'I have a change'
     codes = treediff.get_opcodes(old, new)
     self.assertEquals([('delete', 9, 19)], codes)
Exemplo n.º 7
0
 def test_ins_opcodes(self):
     old = "I a string to change"
     new = "I have a string to change"
     codes = treediff.get_opcodes(old, new)
     self.assertEquals([('insert', 2, 'have ')], codes)
Exemplo n.º 8
0
 def test_getopcodes(self):
     old = 'I have a string to change'
     new = 'We have a string to change now'
     codes = treediff.get_opcodes(old, new)
     self.assertEquals([[('delete', 0, 1), ('insert', 0, 'We')],
                        ('insert', 25, ' now')], codes)