Mercurial > hg
comparison tests/test-linerange.py @ 43366:ee3a55c8fd0f stable
py3: fix exception message check in test-linerange.py's testOutOfRange
Differential Revision: https://phab.mercurial-scm.org/D7192
author | Emmanuel Leblond <emmanuel.leblond@gmail.com> |
---|---|
date | Fri, 01 Nov 2019 17:31:47 +0100 |
parents | 2372284d9457 |
children | 6000f5b25c9b |
comparison
equal
deleted
inserted
replaced
43365:899e55e2d375 | 43366:ee3a55c8fd0f |
---|---|
1 from __future__ import absolute_import | 1 from __future__ import absolute_import |
2 | 2 |
3 import unittest | 3 import unittest |
4 from mercurial import error, mdiff | 4 from mercurial import error, mdiff |
5 from mercurial.utils import stringutil | |
5 | 6 |
6 # for readability, line numbers are 0-origin | 7 # for readability, line numbers are 0-origin |
7 text1 = b''' | 8 text1 = b''' |
8 00 at OLD | 9 00 at OLD |
9 01 at OLD | 10 01 at OLD |
226 # Could be `with self.assertRaises(error.Abort)` but python2.6 | 227 # Could be `with self.assertRaises(error.Abort)` but python2.6 |
227 # does not have assertRaises context manager. | 228 # does not have assertRaises context manager. |
228 try: | 229 try: |
229 mdiff.blocksinrange(self.blocks, linerange2) | 230 mdiff.blocksinrange(self.blocks, linerange2) |
230 except exctype as exc: | 231 except exctype as exc: |
231 self.assertTrue('line range exceeds file size' in str(exc)) | 232 self.assertTrue( |
233 b'line range exceeds file size' | |
234 in stringutil.forcebytestr(exc) | |
235 ) | |
232 else: | 236 else: |
233 self.fail('%s not raised' % exctype.__name__) | 237 self.fail('%s not raised' % exctype.__name__) |
234 | 238 |
235 | 239 |
236 if __name__ == '__main__': | 240 if __name__ == '__main__': |