comparison tests/test-simplemerge.py @ 4516:96d8a56d4ef9

Removed trailing whitespace and tabs from python files
author Thomas Arendsen Hein <thomas@intevation.de>
date Wed, 06 Jun 2007 20:22:52 +0200
parents 2e3c54fb79a3
children ff7253a0d1da
comparison
equal deleted inserted replaced
4515:86a66cce9566 4516:96d8a56d4ef9
36 ############################################################ 36 ############################################################
37 # test case data from the gnu diffutils manual 37 # test case data from the gnu diffutils manual
38 # common base 38 # common base
39 TZU = split_lines(""" The Nameless is the origin of Heaven and Earth; 39 TZU = split_lines(""" The Nameless is the origin of Heaven and Earth;
40 The named is the mother of all things. 40 The named is the mother of all things.
41 41
42 Therefore let there always be non-being, 42 Therefore let there always be non-being,
43 so we may see their subtlety, 43 so we may see their subtlety,
44 And let there always be being, 44 And let there always be being,
45 so we may see their outcome. 45 so we may see their outcome.
46 The two are the same, 46 The two are the same,
67 67
68 TAO = split_lines(""" The Way that can be told of is not the eternal Way; 68 TAO = split_lines(""" The Way that can be told of is not the eternal Way;
69 The name that can be named is not the eternal name. 69 The name that can be named is not the eternal name.
70 The Nameless is the origin of Heaven and Earth; 70 The Nameless is the origin of Heaven and Earth;
71 The named is the mother of all things. 71 The named is the mother of all things.
72 72
73 Therefore let there always be non-being, 73 Therefore let there always be non-being,
74 so we may see their subtlety, 74 so we may see their subtlety,
75 And let there always be being, 75 And let there always be being,
76 so we may see their result. 76 so we may see their result.
77 The two are the same, 77 The two are the same,
78 But after they are produced, 78 But after they are produced,
79 they have different names. 79 they have different names.
80 80
81 -- The Way of Lao-Tzu, tr. Wing-tsit Chan 81 -- The Way of Lao-Tzu, tr. Wing-tsit Chan
82 82
83 """) 83 """)
84 84
85 MERGED_RESULT = split_lines(""" The Way that can be told of is not the eternal Way; 85 MERGED_RESULT = split_lines(""" The Way that can be told of is not the eternal Way;
93 The two are the same, 93 The two are the same,
94 But after they are produced, 94 But after they are produced,
95 they have different names. 95 they have different names.
96 <<<<<<< LAO 96 <<<<<<< LAO
97 ======= 97 =======
98 98
99 -- The Way of Lao-Tzu, tr. Wing-tsit Chan 99 -- The Way of Lao-Tzu, tr. Wing-tsit Chan
100 100
101 >>>>>>> TAO 101 >>>>>>> TAO
102 """) 102 """)
103 103
142 ('unchanged', 0, 1)]) 142 ('unchanged', 0, 1)])
143 143
144 self.assertEquals(list(m3.merge_groups()), 144 self.assertEquals(list(m3.merge_groups()),
145 [('a', ['aaa', 'bbb']), 145 [('a', ['aaa', 'bbb']),
146 ('unchanged', ['zz'])]) 146 ('unchanged', ['zz'])])
147 147
148 def test_null_insert(self): 148 def test_null_insert(self):
149 m3 = Merge3([], 149 m3 = Merge3([],
150 ['aaa', 'bbb'], 150 ['aaa', 'bbb'],
151 []) 151 [])
152 # todo: should use a sentinal at end as from get_matching_blocks 152 # todo: should use a sentinal at end as from get_matching_blocks
233 name_b='b', 233 name_b='b',
234 start_marker='<<', 234 start_marker='<<',
235 mid_marker='--', 235 mid_marker='--',
236 end_marker='>>') 236 end_marker='>>')
237 self.assertEquals(''.join(ml), 'aaa\n222\nbbb\n') 237 self.assertEquals(''.join(ml), 'aaa\n222\nbbb\n')
238 238
239 239
240 def test_insert_clash(self): 240 def test_insert_clash(self):
241 """Both try to insert lines in the same place.""" 241 """Both try to insert lines in the same place."""
242 m3 = Merge3(['aaa\n', 'bbb\n'], 242 m3 = Merge3(['aaa\n', 'bbb\n'],
243 ['aaa\n', '111\n', 'bbb\n'], 243 ['aaa\n', '111\n', 'bbb\n'],
368 """Reprocessing and showing base breaks correctly""" 368 """Reprocessing and showing base breaks correctly"""
369 base_text = ("a\n" * 20).splitlines(True) 369 base_text = ("a\n" * 20).splitlines(True)
370 this_text = ("a\n"*10+"b\n" * 10).splitlines(True) 370 this_text = ("a\n"*10+"b\n" * 10).splitlines(True)
371 other_text = ("a\n"*10+"c\n"+"b\n" * 8 + "c\n").splitlines(True) 371 other_text = ("a\n"*10+"c\n"+"b\n" * 8 + "c\n").splitlines(True)
372 m3 = Merge3(base_text, other_text, this_text) 372 m3 = Merge3(base_text, other_text, this_text)
373 m_lines = m3.merge_lines('OTHER', 'THIS', reprocess=True, 373 m_lines = m3.merge_lines('OTHER', 'THIS', reprocess=True,
374 base_marker='|||||||') 374 base_marker='|||||||')
375 self.assertRaises(CantReprocessAndShowBase, list, m_lines) 375 self.assertRaises(CantReprocessAndShowBase, list, m_lines)
376 376
377 def test_binary(self): 377 def test_binary(self):
378 self.assertRaises(util.Abort, Merge3, ['\x00'], ['a'], ['b']) 378 self.assertRaises(util.Abort, Merge3, ['\x00'], ['a'], ['b'])