230
231
(self.fb_key, 'new content\n')],
231
232
self.ann.annotate_flat(self.ff_key))
234
def test_annotate_flat_respects_break_ann_tie(self):
235
tiebreaker = annotate._break_annotation_tie
238
def custom_tiebreaker(annotated_lines):
239
self.assertEqual(2, len(annotated_lines))
240
left = annotated_lines[0]
241
self.assertEqual(2, len(left))
242
self.assertEqual('new content\n', left[1])
243
right = annotated_lines[1]
244
self.assertEqual(2, len(right))
245
self.assertEqual('new content\n', right[1])
246
calls.append((left[0], right[0]))
247
# Our custom tiebreaker takes the *largest* value, rather than
248
# the *smallest* value
249
if left[0] < right[0]:
253
annotate._break_annotation_tie = custom_tiebreaker
254
self.make_many_way_common_merge_text()
255
self.assertEqual([(self.fa_key, 'simple\n'),
256
(self.fe_key, 'new content\n')],
257
self.ann.annotate_flat(self.ff_key))
258
self.assertEqual([(self.fe_key, self.fc_key),
259
(self.fe_key, self.fb_key)], calls)
261
annotate._break_annotation_tie = tiebreaker
234
264
def test_needed_keys_simple(self):
235
265
self.make_simple_text()