##// END OF EJS Templates
py3: fix fix doctests to be bytes-safe
Yuya Nishihara -
r37230:893ff8c3 default
parent child Browse files
Show More
@@ -303,33 +303,34 b' def difflineranges(content1, content2):'
303 present in content1. Relies on mdiff's idea of where the line endings are in
303 present in content1. Relies on mdiff's idea of where the line endings are in
304 the string.
304 the string.
305
305
306 >>> lines = lambda s: '\\n'.join([c for c in s])
306 >>> from mercurial import pycompat
307 >>> lines = lambda s: b'\\n'.join([c for c in pycompat.iterbytestr(s)])
307 >>> difflineranges2 = lambda a, b: difflineranges(lines(a), lines(b))
308 >>> difflineranges2 = lambda a, b: difflineranges(lines(a), lines(b))
308 >>> difflineranges2('', '')
309 >>> difflineranges2(b'', b'')
309 []
310 >>> difflineranges2('a', '')
311 []
310 []
312 >>> difflineranges2('', 'A')
311 >>> difflineranges2(b'a', b'')
313 [(1, 1)]
314 >>> difflineranges2('a', 'a')
315 []
312 []
316 >>> difflineranges2('a', 'A')
313 >>> difflineranges2(b'', b'A')
317 [(1, 1)]
314 [(1, 1)]
318 >>> difflineranges2('ab', '')
315 >>> difflineranges2(b'a', b'a')
319 []
316 []
320 >>> difflineranges2('', 'AB')
317 >>> difflineranges2(b'a', b'A')
318 [(1, 1)]
319 >>> difflineranges2(b'ab', b'')
320 []
321 >>> difflineranges2(b'', b'AB')
321 [(1, 2)]
322 [(1, 2)]
322 >>> difflineranges2('abc', 'ac')
323 >>> difflineranges2(b'abc', b'ac')
323 []
324 []
324 >>> difflineranges2('ab', 'aCb')
325 >>> difflineranges2(b'ab', b'aCb')
325 [(2, 2)]
326 [(2, 2)]
326 >>> difflineranges2('abc', 'aBc')
327 >>> difflineranges2(b'abc', b'aBc')
327 [(2, 2)]
328 [(2, 2)]
328 >>> difflineranges2('ab', 'AB')
329 >>> difflineranges2(b'ab', b'AB')
329 [(1, 2)]
330 [(1, 2)]
330 >>> difflineranges2('abcde', 'aBcDe')
331 >>> difflineranges2(b'abcde', b'aBcDe')
331 [(2, 2), (4, 4)]
332 [(2, 2), (4, 4)]
332 >>> difflineranges2('abcde', 'aBCDe')
333 >>> difflineranges2(b'abcde', b'aBCDe')
333 [(2, 4)]
334 [(2, 4)]
334 """
335 """
335 ranges = []
336 ranges = []
General Comments 0
You need to be logged in to leave comments. Login now