changeset 37215:893ff8c3bc57

py3: fix fix doctests to be bytes-safe
author Yuya Nishihara <yuya@tcha.org>
date Sat, 31 Mar 2018 10:28:18 +0900
parents f09a2eab11cf
children 3bc609bcfe77
files hgext/fix.py
diffstat 1 files changed, 17 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- 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 = []