diff tests/test-simplemerge.py @ 32319: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
line wrap: on
line diff
--- a/tests/test-simplemerge.py	Sat May 13 11:42:42 2017 -0700
+++ b/tests/test-simplemerge.py	Sat May 13 11:52:44 2017 -0700
@@ -326,7 +326,8 @@
         self.assertEquals(ml, MERGED_RESULT)
 
     def test_binary(self):
-        self.assertRaises(error.Abort, Merge3, ['\x00'], ['a'], ['b'])
+        with self.assertRaises(error.Abort):
+            Merge3(['\x00'], ['a'], ['b'])
 
     def test_dos_text(self):
         base_text = 'a\r\n'