This makes the test pass on Python 3.
- skip-blame because just b'' prefixes
( )
indygreg |
hg-reviewers |
This makes the test pass on Python 3.
Lint Skipped |
Unit Tests Skipped |
from __future__ import absolute_import | from __future__ import absolute_import | ||||
import unittest | import unittest | ||||
from mercurial import error, mdiff | from mercurial import error, mdiff | ||||
# for readability, line numbers are 0-origin | # for readability, line numbers are 0-origin | ||||
text1 = ''' | text1 = b''' | ||||
00 at OLD | 00 at OLD | ||||
01 at OLD | 01 at OLD | ||||
02 at OLD | 02 at OLD | ||||
02 at NEW, 03 at OLD | 02 at NEW, 03 at OLD | ||||
03 at NEW, 04 at OLD | 03 at NEW, 04 at OLD | ||||
04 at NEW, 05 at OLD | 04 at NEW, 05 at OLD | ||||
05 at NEW, 06 at OLD | 05 at NEW, 06 at OLD | ||||
07 at OLD | 07 at OLD | ||||
08 at OLD | 08 at OLD | ||||
09 at OLD | 09 at OLD | ||||
10 at OLD | 10 at OLD | ||||
11 at OLD | 11 at OLD | ||||
'''[1:] # strip initial LF | '''[1:] # strip initial LF | ||||
text2 = ''' | text2 = b''' | ||||
00 at NEW | 00 at NEW | ||||
01 at NEW | 01 at NEW | ||||
02 at NEW, 03 at OLD | 02 at NEW, 03 at OLD | ||||
03 at NEW, 04 at OLD | 03 at NEW, 04 at OLD | ||||
04 at NEW, 05 at OLD | 04 at NEW, 05 at OLD | ||||
05 at NEW, 06 at OLD | 05 at NEW, 06 at OLD | ||||
06 at NEW | 06 at NEW | ||||
07 at NEW | 07 at NEW | ||||
skipped = [b not in filtered for b in blocks] | skipped = [b not in filtered for b in blocks] | ||||
return rangea, skipped | return rangea, skipped | ||||
class blocksinrangetests(unittest.TestCase): | class blocksinrangetests(unittest.TestCase): | ||||
def setUp(self): | def setUp(self): | ||||
self.blocks = list(mdiff.allblocks(text1, text2)) | self.blocks = list(mdiff.allblocks(text1, text2)) | ||||
assert self.blocks == [ | assert self.blocks == [ | ||||
([0, 3, 0, 2], '!'), | ([0, 3, 0, 2], b'!'), | ||||
((3, 7, 2, 6), '='), | ((3, 7, 2, 6), b'='), | ||||
([7, 12, 6, 12], '!'), | ([7, 12, 6, 12], b'!'), | ||||
((12, 12, 12, 12), '='), | ((12, 12, 12, 12), b'='), | ||||
], self.blocks | ], self.blocks | ||||
def testWithinEqual(self): | def testWithinEqual(self): | ||||
"""linerange within an "=" block""" | """linerange within an "=" block""" | ||||
# IDX 0 1 | # IDX 0 1 | ||||
# 012345678901 | # 012345678901 | ||||
# SRC NNOOOONNNNNN (New/Old) | # SRC NNOOOONNNNNN (New/Old) | ||||
# ^^ | # ^^ |