py3: fix fix doctests to be bytes-safe
authorYuya Nishihara <yuya@tcha.org>
Sat, 31 Mar 2018 10:28:18 +0900
changeset 37213 893ff8c3bc57
parent 37212 f09a2eab11cf
child 37214 3bc609bcfe77
py3: fix fix doctests to be bytes-safe
hgext/fix.py
--- a/hgext/fix.py	Wed Mar 28 00:11:09 2018 -0400
+++ b/hgext/fix.py	Sat Mar 31 10:28:18 2018 +0900
@@ -303,33 +303,34 @@
     present in content1. Relies on mdiff's idea of where the line endings are in
     the string.
 
-    >>> lines = lambda s: '\\n'.join([c for c in s])
+    >>> from mercurial import pycompat
+    >>> lines = lambda s: b'\\n'.join([c for c in pycompat.iterbytestr(s)])
     >>> difflineranges2 = lambda a, b: difflineranges(lines(a), lines(b))
-    >>> difflineranges2('', '')
-    []
-    >>> difflineranges2('a', '')
+    >>> difflineranges2(b'', b'')
     []
-    >>> difflineranges2('', 'A')
-    [(1, 1)]
-    >>> difflineranges2('a', 'a')
+    >>> difflineranges2(b'a', b'')
     []
-    >>> difflineranges2('a', 'A')
+    >>> difflineranges2(b'', b'A')
     [(1, 1)]
-    >>> difflineranges2('ab', '')
+    >>> difflineranges2(b'a', b'a')
     []
-    >>> difflineranges2('', 'AB')
+    >>> difflineranges2(b'a', b'A')
+    [(1, 1)]
+    >>> difflineranges2(b'ab', b'')
+    []
+    >>> difflineranges2(b'', b'AB')
     [(1, 2)]
-    >>> difflineranges2('abc', 'ac')
+    >>> difflineranges2(b'abc', b'ac')
     []
-    >>> difflineranges2('ab', 'aCb')
+    >>> difflineranges2(b'ab', b'aCb')
     [(2, 2)]
-    >>> difflineranges2('abc', 'aBc')
+    >>> difflineranges2(b'abc', b'aBc')
     [(2, 2)]
-    >>> difflineranges2('ab', 'AB')
+    >>> difflineranges2(b'ab', b'AB')
     [(1, 2)]
-    >>> difflineranges2('abcde', 'aBcDe')
+    >>> difflineranges2(b'abcde', b'aBcDe')
     [(2, 2), (4, 4)]
-    >>> difflineranges2('abcde', 'aBCDe')
+    >>> difflineranges2(b'abcde', b'aBCDe')
     [(2, 4)]
     """
     ranges = []