changeset 40250:7759c26a3a0b

py3: do I/O in bytes in test-help.t
author Yuya Nishihara <yuya@tcha.org>
date Sat, 13 Oct 2018 14:11:12 +0200
parents c9e8c93e241c
children 3c89227788a2
files tests/test-help.t
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-help.t	Sat Oct 13 07:55:34 2018 -0400
+++ b/tests/test-help.t	Sat Oct 13 14:11:12 2018 +0200
@@ -1799,13 +1799,13 @@
 
   $ "$PYTHON" <<EOF
   > def escape(s):
-  >     return ''.join('\u%x' % ord(uc) for uc in s.decode('cp932'))
+  >     return b''.join(b'\\u%x' % ord(uc) for uc in s.decode('cp932'))
   > # translation of "record" in ja_JP.cp932
-  > upper = "\x8bL\x98^"
+  > upper = b"\x8bL\x98^"
   > # str.lower()-ed section name should be treated as different one
-  > lower = "\x8bl\x98^"
-  > with open('ambiguous.py', 'w') as fp:
-  >     fp.write("""# ambiguous section names in ja_JP.cp932
+  > lower = b"\x8bl\x98^"
+  > with open('ambiguous.py', 'wb') as fp:
+  >     fp.write(b"""# ambiguous section names in ja_JP.cp932
   > u'''summary of extension
   > 
   > %s
@@ -1832,8 +1832,9 @@
   > EOF
 
   $ "$PYTHON" <<EOF | sh
-  > upper = "\x8bL\x98^"
-  > print("hg --encoding cp932 help -e ambiguous.%s" % upper)
+  > from mercurial import pycompat
+  > upper = b"\x8bL\x98^"
+  > pycompat.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % upper)
   > EOF
   \x8bL\x98^ (esc)
   ----
@@ -1842,8 +1843,9 @@
   
 
   $ "$PYTHON" <<EOF | sh
-  > lower = "\x8bl\x98^"
-  > print("hg --encoding cp932 help -e ambiguous.%s" % lower)
+  > from mercurial import pycompat
+  > lower = b"\x8bl\x98^"
+  > pycompat.stdout.write(b"hg --encoding cp932 help -e ambiguous.%s\n" % lower)
   > EOF
   \x8bl\x98^ (esc)
   ----