comparison tests/test-simplemerge.py @ 32279:68c43a416585

tests: use context manager form of assertRaises Support for using unittest.TestCase.assertRaises as a context manager was added in Python 2.7. This form is more readable, especially for complex tests. While I was here, I also restored the use of assertRaisesRegexp, which was removed in c6921568cd20 for Python 2.6 compatibility.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 13 May 2017 11:52:44 -0700
parents 2d433fa7ff44
children f0b6fbea00cf
comparison
equal deleted inserted replaced
32278:7c3ef55dedbe 32279:68c43a416585
324 self.log('merge result:') 324 self.log('merge result:')
325 self.log(''.join(ml)) 325 self.log(''.join(ml))
326 self.assertEquals(ml, MERGED_RESULT) 326 self.assertEquals(ml, MERGED_RESULT)
327 327
328 def test_binary(self): 328 def test_binary(self):
329 self.assertRaises(error.Abort, Merge3, ['\x00'], ['a'], ['b']) 329 with self.assertRaises(error.Abort):
330 Merge3(['\x00'], ['a'], ['b'])
330 331
331 def test_dos_text(self): 332 def test_dos_text(self):
332 base_text = 'a\r\n' 333 base_text = 'a\r\n'
333 this_text = 'b\r\n' 334 this_text = 'b\r\n'
334 other_text = 'c\r\n' 335 other_text = 'c\r\n'