def test_post_process_filtered_equals_with_indentation(self): """Testing post_process_filtered_equals with indentation changes""" opcodes = [ ('equal', 0, 10, 0, 10, {}), ('insert', 10, 20, 0, 10, {}), ('equal', 20, 30, 10, 20, { 'indentation_changes': { '21-11': (True, 4), } }), ('equal', 30, 40, 20, 30, {}), ('filtered-equal', 30, 50, 20, 40, {}), ] new_opcodes = list(post_process_filtered_equals(opcodes)) self.assertEqual(new_opcodes, [ ('equal', 0, 10, 0, 10, {}), ('insert', 10, 20, 0, 10, {}), ('equal', 20, 30, 10, 20, { 'indentation_changes': { '21-11': (True, 4), } }), ('equal', 30, 50, 20, 40, {}), ])
def test_post_process_filtered_equals_with_indentation(self): """Testing post_process_filtered_equals with indentation changes""" opcodes = [ ('equal', 0, 10, 0, 10, {}), ('insert', 10, 20, 0, 10, {}), ('equal', 20, 30, 10, 20, { 'indentation_changes': { '21-11': (True, 4), } }), ('equal', 30, 40, 20, 30, {}), ('filtered-equal', 30, 50, 20, 40, {}), ] new_opcodes = list(post_process_filtered_equals(opcodes)) self.assertEqual( new_opcodes, [ ('equal', 0, 10, 0, 10, {}), ('insert', 10, 20, 0, 10, {}), ('equal', 20, 30, 10, 20, { 'indentation_changes': { '21-11': (True, 4), } }), ('equal', 30, 50, 20, 40, {}), ])
def _apply_meta_processors(self, opcodes): if self.interfilediff: # When filtering out opcodes, we may have converted chunks into # "filtered-equal" chunks. This allowed us to skip any additional # processing, particularly the indentation highlighting. It's # now time to turn those back into "equal" chunks. opcodes = post_process_filtered_equals(opcodes) for opcode in opcodes: yield opcode
def _apply_meta_processors(self, opcodes): if self.interfilediff: # When filtering out opcodes, we may have converted chunks into # "filtered-equal" chunks. This allowed us to skip any additional # processing, particularly the indentation highlighting. It's # now time to turn those back into "equal" chunks. opcodes = post_process_filtered_equals(opcodes) for opcode in opcodes: yield opcode
def test_post_process_filtered_equals(self): """Testing post_process_filtered_equals""" opcodes = [ ('equal', 0, 10, 0, 10, {}), ('insert', 10, 20, 0, 10, {}), ('equal', 20, 30, 10, 20, {}), ('equal', 30, 40, 20, 30, {}), ('filtered-equal', 40, 50, 30, 40, {}), ] new_opcodes = list(post_process_filtered_equals(opcodes)) self.assertEqual(new_opcodes, [ ('equal', 0, 10, 0, 10, {}), ('insert', 10, 20, 0, 10, {}), ('equal', 20, 50, 10, 40, {}), ])
def test_post_process_filtered_equals(self): """Testing post_process_filtered_equals""" opcodes = [ ('equal', 0, 10, 0, 10, {}), ('insert', 10, 20, 0, 10, {}), ('equal', 20, 30, 10, 20, {}), ('equal', 30, 40, 20, 30, {}), ('filtered-equal', 40, 50, 30, 40, {}), ] new_opcodes = list(post_process_filtered_equals(opcodes)) self.assertEqual( new_opcodes, [ ('equal', 0, 10, 0, 10, {}), ('insert', 10, 20, 0, 10, {}), ('equal', 20, 50, 10, 40, {}), ])