##// END OF EJS Templates
tests: replace use of assertEquals with assertEqual in test-simplemerge.py...
Augie Fackler -
r37908:a3ed6e72 default
parent child Browse files
Show More
@@ -128,20 +128,20 b' class TestMerge3(TestCase):'
128 ['aaa', 'bbb'],
128 ['aaa', 'bbb'],
129 ['aaa', 'bbb'])
129 ['aaa', 'bbb'])
130
130
131 self.assertEquals(m3.find_unconflicted(),
131 self.assertEqual(m3.find_unconflicted(),
132 [(0, 2)])
132 [(0, 2)])
133
133
134 self.assertEquals(list(m3.find_sync_regions()),
134 self.assertEqual(list(m3.find_sync_regions()),
135 [(0, 2,
135 [(0, 2,
136 0, 2,
136 0, 2,
137 0, 2),
137 0, 2),
138 (2, 2, 2, 2, 2, 2)])
138 (2, 2, 2, 2, 2, 2)])
139
139
140 self.assertEquals(list(m3.merge_regions()),
140 self.assertEqual(list(m3.merge_regions()),
141 [('unchanged', 0, 2)])
141 [('unchanged', 0, 2)])
142
142
143 self.assertEquals(list(m3.merge_groups()),
143 self.assertEqual(list(m3.merge_groups()),
144 [('unchanged', ['aaa', 'bbb'])])
144 [('unchanged', ['aaa', 'bbb'])])
145
145
146 def test_front_insert(self):
146 def test_front_insert(self):
147 m3 = Merge3(['zz'],
147 m3 = Merge3(['zz'],
@@ -150,17 +150,17 b' class TestMerge3(TestCase):'
150
150
151 # todo: should use a sentinel at end as from get_matching_blocks
151 # todo: should use a sentinel at end as from get_matching_blocks
152 # to match without zz
152 # to match without zz
153 self.assertEquals(list(m3.find_sync_regions()),
153 self.assertEqual(list(m3.find_sync_regions()),
154 [(0, 1, 2, 3, 0, 1),
154 [(0, 1, 2, 3, 0, 1),
155 (1, 1, 3, 3, 1, 1)])
155 (1, 1, 3, 3, 1, 1)])
156
156
157 self.assertEquals(list(m3.merge_regions()),
157 self.assertEqual(list(m3.merge_regions()),
158 [('a', 0, 2),
158 [('a', 0, 2),
159 ('unchanged', 0, 1)])
159 ('unchanged', 0, 1)])
160
160
161 self.assertEquals(list(m3.merge_groups()),
161 self.assertEqual(list(m3.merge_groups()),
162 [('a', ['aaa', 'bbb']),
162 [('a', ['aaa', 'bbb']),
163 ('unchanged', ['zz'])])
163 ('unchanged', ['zz'])])
164
164
165 def test_null_insert(self):
165 def test_null_insert(self):
166 m3 = Merge3([],
166 m3 = Merge3([],
@@ -168,14 +168,14 b' class TestMerge3(TestCase):'
168 [])
168 [])
169 # todo: should use a sentinel at end as from get_matching_blocks
169 # todo: should use a sentinel at end as from get_matching_blocks
170 # to match without zz
170 # to match without zz
171 self.assertEquals(list(m3.find_sync_regions()),
171 self.assertEqual(list(m3.find_sync_regions()),
172 [(0, 0, 2, 2, 0, 0)])
172 [(0, 0, 2, 2, 0, 0)])
173
173
174 self.assertEquals(list(m3.merge_regions()),
174 self.assertEqual(list(m3.merge_regions()),
175 [('a', 0, 2)])
175 [('a', 0, 2)])
176
176
177 self.assertEquals(list(m3.merge_lines()),
177 self.assertEqual(list(m3.merge_lines()),
178 ['aaa', 'bbb'])
178 ['aaa', 'bbb'])
179
179
180 def test_no_conflicts(self):
180 def test_no_conflicts(self):
181 """No conflicts because only one side changed"""
181 """No conflicts because only one side changed"""
@@ -183,42 +183,42 b' class TestMerge3(TestCase):'
183 ['aaa', '111', 'bbb'],
183 ['aaa', '111', 'bbb'],
184 ['aaa', 'bbb'])
184 ['aaa', 'bbb'])
185
185
186 self.assertEquals(m3.find_unconflicted(),
186 self.assertEqual(m3.find_unconflicted(),
187 [(0, 1), (1, 2)])
187 [(0, 1), (1, 2)])
188
188
189 self.assertEquals(list(m3.find_sync_regions()),
189 self.assertEqual(list(m3.find_sync_regions()),
190 [(0, 1, 0, 1, 0, 1),
190 [(0, 1, 0, 1, 0, 1),
191 (1, 2, 2, 3, 1, 2),
191 (1, 2, 2, 3, 1, 2),
192 (2, 2, 3, 3, 2, 2)])
192 (2, 2, 3, 3, 2, 2)])
193
193
194 self.assertEquals(list(m3.merge_regions()),
194 self.assertEqual(list(m3.merge_regions()),
195 [('unchanged', 0, 1),
195 [('unchanged', 0, 1),
196 ('a', 1, 2),
196 ('a', 1, 2),
197 ('unchanged', 1, 2)])
197 ('unchanged', 1, 2)])
198
198
199 def test_append_a(self):
199 def test_append_a(self):
200 m3 = Merge3(['aaa\n', 'bbb\n'],
200 m3 = Merge3(['aaa\n', 'bbb\n'],
201 ['aaa\n', 'bbb\n', '222\n'],
201 ['aaa\n', 'bbb\n', '222\n'],
202 ['aaa\n', 'bbb\n'])
202 ['aaa\n', 'bbb\n'])
203
203
204 self.assertEquals(''.join(m3.merge_lines()),
204 self.assertEqual(''.join(m3.merge_lines()),
205 'aaa\nbbb\n222\n')
205 'aaa\nbbb\n222\n')
206
206
207 def test_append_b(self):
207 def test_append_b(self):
208 m3 = Merge3(['aaa\n', 'bbb\n'],
208 m3 = Merge3(['aaa\n', 'bbb\n'],
209 ['aaa\n', 'bbb\n'],
209 ['aaa\n', 'bbb\n'],
210 ['aaa\n', 'bbb\n', '222\n'])
210 ['aaa\n', 'bbb\n', '222\n'])
211
211
212 self.assertEquals(''.join(m3.merge_lines()),
212 self.assertEqual(''.join(m3.merge_lines()),
213 'aaa\nbbb\n222\n')
213 'aaa\nbbb\n222\n')
214
214
215 def test_append_agreement(self):
215 def test_append_agreement(self):
216 m3 = Merge3(['aaa\n', 'bbb\n'],
216 m3 = Merge3(['aaa\n', 'bbb\n'],
217 ['aaa\n', 'bbb\n', '222\n'],
217 ['aaa\n', 'bbb\n', '222\n'],
218 ['aaa\n', 'bbb\n', '222\n'])
218 ['aaa\n', 'bbb\n', '222\n'])
219
219
220 self.assertEquals(''.join(m3.merge_lines()),
220 self.assertEqual(''.join(m3.merge_lines()),
221 'aaa\nbbb\n222\n')
221 'aaa\nbbb\n222\n')
222
222
223 def test_append_clash(self):
223 def test_append_clash(self):
224 m3 = Merge3(['aaa\n', 'bbb\n'],
224 m3 = Merge3(['aaa\n', 'bbb\n'],
@@ -230,14 +230,14 b' class TestMerge3(TestCase):'
230 start_marker='<<',
230 start_marker='<<',
231 mid_marker='--',
231 mid_marker='--',
232 end_marker='>>')
232 end_marker='>>')
233 self.assertEquals(''.join(ml),
233 self.assertEqual(''.join(ml),
234 'aaa\n'
234 'aaa\n'
235 'bbb\n'
235 'bbb\n'
236 '<< a\n'
236 '<< a\n'
237 '222\n'
237 '222\n'
238 '--\n'
238 '--\n'
239 '333\n'
239 '333\n'
240 '>> b\n'
240 '>> b\n'
241 )
241 )
242
242
243 def test_insert_agreement(self):
243 def test_insert_agreement(self):
@@ -250,7 +250,7 b' class TestMerge3(TestCase):'
250 start_marker='<<',
250 start_marker='<<',
251 mid_marker='--',
251 mid_marker='--',
252 end_marker='>>')
252 end_marker='>>')
253 self.assertEquals(''.join(ml), 'aaa\n222\nbbb\n')
253 self.assertEqual(''.join(ml), 'aaa\n222\nbbb\n')
254
254
255
255
256 def test_insert_clash(self):
256 def test_insert_clash(self):
@@ -259,31 +259,31 b' class TestMerge3(TestCase):'
259 ['aaa\n', '111\n', 'bbb\n'],
259 ['aaa\n', '111\n', 'bbb\n'],
260 ['aaa\n', '222\n', 'bbb\n'])
260 ['aaa\n', '222\n', 'bbb\n'])
261
261
262 self.assertEquals(m3.find_unconflicted(),
262 self.assertEqual(m3.find_unconflicted(),
263 [(0, 1), (1, 2)])
263 [(0, 1), (1, 2)])
264
264
265 self.assertEquals(list(m3.find_sync_regions()),
265 self.assertEqual(list(m3.find_sync_regions()),
266 [(0, 1, 0, 1, 0, 1),
266 [(0, 1, 0, 1, 0, 1),
267 (1, 2, 2, 3, 2, 3),
267 (1, 2, 2, 3, 2, 3),
268 (2, 2, 3, 3, 3, 3)])
268 (2, 2, 3, 3, 3, 3)])
269
269
270 self.assertEquals(list(m3.merge_regions()),
270 self.assertEqual(list(m3.merge_regions()),
271 [('unchanged', 0, 1),
271 [('unchanged', 0, 1),
272 ('conflict', 1, 1, 1, 2, 1, 2),
272 ('conflict', 1, 1, 1, 2, 1, 2),
273 ('unchanged', 1, 2)])
273 ('unchanged', 1, 2)])
274
274
275 self.assertEquals(list(m3.merge_groups()),
275 self.assertEqual(list(m3.merge_groups()),
276 [('unchanged', ['aaa\n']),
276 [('unchanged', ['aaa\n']),
277 ('conflict', [], ['111\n'], ['222\n']),
277 ('conflict', [], ['111\n'], ['222\n']),
278 ('unchanged', ['bbb\n']),
278 ('unchanged', ['bbb\n']),
279 ])
279 ])
280
280
281 ml = m3.merge_lines(name_a='a',
281 ml = m3.merge_lines(name_a='a',
282 name_b='b',
282 name_b='b',
283 start_marker='<<',
283 start_marker='<<',
284 mid_marker='--',
284 mid_marker='--',
285 end_marker='>>')
285 end_marker='>>')
286 self.assertEquals(''.join(ml),
286 self.assertEqual(''.join(ml),
287 '''aaa
287 '''aaa
288 << a
288 << a
289 111
289 111
@@ -299,13 +299,13 b' bbb'
299 ['aaa', '111', 'bbb'],
299 ['aaa', '111', 'bbb'],
300 ['aaa', '222', 'bbb'])
300 ['aaa', '222', 'bbb'])
301
301
302 self.assertEquals(m3.find_unconflicted(),
302 self.assertEqual(m3.find_unconflicted(),
303 [(0, 1), (2, 3)])
303 [(0, 1), (2, 3)])
304
304
305 self.assertEquals(list(m3.find_sync_regions()),
305 self.assertEqual(list(m3.find_sync_regions()),
306 [(0, 1, 0, 1, 0, 1),
306 [(0, 1, 0, 1, 0, 1),
307 (2, 3, 2, 3, 2, 3),
307 (2, 3, 2, 3, 2, 3),
308 (3, 3, 3, 3, 3, 3)])
308 (3, 3, 3, 3, 3, 3)])
309
309
310 def test_replace_multi(self):
310 def test_replace_multi(self):
311 """Replacement with regions of different size."""
311 """Replacement with regions of different size."""
@@ -313,14 +313,14 b' bbb'
313 ['aaa', '111', '111', '111', 'bbb'],
313 ['aaa', '111', '111', '111', 'bbb'],
314 ['aaa', '222', '222', '222', '222', 'bbb'])
314 ['aaa', '222', '222', '222', '222', 'bbb'])
315
315
316 self.assertEquals(m3.find_unconflicted(),
316 self.assertEqual(m3.find_unconflicted(),
317 [(0, 1), (3, 4)])
317 [(0, 1), (3, 4)])
318
318
319
319
320 self.assertEquals(list(m3.find_sync_regions()),
320 self.assertEqual(list(m3.find_sync_regions()),
321 [(0, 1, 0, 1, 0, 1),
321 [(0, 1, 0, 1, 0, 1),
322 (3, 4, 4, 5, 5, 6),
322 (3, 4, 4, 5, 5, 6),
323 (4, 4, 5, 5, 6, 6)])
323 (4, 4, 5, 5, 6, 6)])
324
324
325 def test_merge_poem(self):
325 def test_merge_poem(self):
326 """Test case from diff3 manual"""
326 """Test case from diff3 manual"""
@@ -328,7 +328,7 b' bbb'
328 ml = list(m3.merge_lines('LAO', 'TAO'))
328 ml = list(m3.merge_lines('LAO', 'TAO'))
329 self.log('merge result:')
329 self.log('merge result:')
330 self.log(''.join(ml))
330 self.log(''.join(ml))
331 self.assertEquals(ml, MERGED_RESULT)
331 self.assertEqual(ml, MERGED_RESULT)
332
332
333 def test_binary(self):
333 def test_binary(self):
334 with self.assertRaises(error.Abort):
334 with self.assertRaises(error.Abort):
@@ -342,7 +342,7 b' bbb'
342 this_text.splitlines(True))
342 this_text.splitlines(True))
343 m_lines = m3.merge_lines('OTHER', 'THIS')
343 m_lines = m3.merge_lines('OTHER', 'THIS')
344 self.assertEqual('<<<<<<< OTHER\r\nc\r\n=======\r\nb\r\n'
344 self.assertEqual('<<<<<<< OTHER\r\nc\r\n=======\r\nb\r\n'
345 '>>>>>>> THIS\r\n'.splitlines(True), list(m_lines))
345 '>>>>>>> THIS\r\n'.splitlines(True), list(m_lines))
346
346
347 def test_mac_text(self):
347 def test_mac_text(self):
348 base_text = 'a\r'
348 base_text = 'a\r'
@@ -352,7 +352,7 b' bbb'
352 this_text.splitlines(True))
352 this_text.splitlines(True))
353 m_lines = m3.merge_lines('OTHER', 'THIS')
353 m_lines = m3.merge_lines('OTHER', 'THIS')
354 self.assertEqual('<<<<<<< OTHER\rc\r=======\rb\r'
354 self.assertEqual('<<<<<<< OTHER\rc\r=======\rb\r'
355 '>>>>>>> THIS\r'.splitlines(True), list(m_lines))
355 '>>>>>>> THIS\r'.splitlines(True), list(m_lines))
356
356
357 if __name__ == '__main__':
357 if __name__ == '__main__':
358 # hide the timer
358 # hide the timer
General Comments 0
You need to be logged in to leave comments. Login now