doctest: do not embed non-ascii characters in docstring
Since the outer docstring is parsed as a unicode on Python 3, we have to
either double-escape or construct non-ascii string from ascii string.
--- a/mercurial/encoding.py Sun Sep 03 15:42:27 2017 +0900
+++ b/mercurial/encoding.py Sun Sep 03 15:47:17 2017 +0900
@@ -247,6 +247,7 @@
If 'leftside' is True, left side of string 's' is trimmed.
'ellipsis' is always placed at trimmed side.
+ >>> from .node import bin
>>> ellipsis = b'+++'
>>> from . import encoding
>>> encoding.encoding = b'utf-8'
@@ -285,7 +286,7 @@
+++
>>> print trim(t, 4, ellipsis=ellipsis, leftside=True)
+++
- >>> t = b'\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa' # invalid byte sequence
+ >>> t = bin(b'112233445566778899aa') # invalid byte sequence
>>> print trim(t, 12, ellipsis=ellipsis)
\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa
>>> print trim(t, 10, ellipsis=ellipsis)
--- a/mercurial/store.py Sun Sep 03 15:42:27 2017 +0900
+++ b/mercurial/store.py Sun Sep 03 15:47:17 2017 +0900
@@ -95,7 +95,7 @@
>>> dec(b'hello~3aworld~3f')
'hello:world?'
- >>> enc(b'the\x07quick\xADshot')
+ >>> enc(b'the\\x07quick\\xADshot')
'the~07quick~adshot'
>>> dec(b'the~07quick~adshot')
'the\\x07quick\\xadshot'
@@ -154,7 +154,7 @@
'hello'
>>> f(b'hello:world?')
'hello~3aworld~3f'
- >>> f(b'the\x07quick\xADshot')
+ >>> f(b'the\\x07quick\\xADshot')
'the~07quick~adshot'
'''
cmap = dict([(chr(x), chr(x)) for x in xrange(127)])