changeset 41345:24bef6a99958

py3: fix up test-encoding-align.t for python3 I'm not super thrilled with how this reads, but the original didn't thrill me either. Differential Revision: https://phab.mercurial-scm.org/D5682
author Augie Fackler <augie@google.com>
date Thu, 24 Jan 2019 14:12:00 -0500
parents 6dadf3f46661
children 9448b2e4c9fa
files contrib/python3-whitelist tests/test-encoding-align.t
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/python3-whitelist	Thu Jan 24 13:57:23 2019 -0500
+++ b/contrib/python3-whitelist	Thu Jan 24 14:12:00 2019 -0500
@@ -165,6 +165,7 @@
 test-empty-group.t
 test-empty.t
 test-encode.t
+test-encoding-align.t
 test-encoding-func.py
 test-encoding-textwrap.t
 test-encoding.t
--- a/tests/test-encoding-align.t	Thu Jan 24 13:57:23 2019 -0500
+++ b/tests/test-encoding-align.t	Thu Jan 24 14:12:00 2019 -0500
@@ -5,6 +5,7 @@
   $ hg init t
   $ cd t
   $ "$PYTHON" << EOF
+  > from mercurial import pycompat
   > # (byte, width) = (6, 4)
   > s = b"\xe7\x9f\xad\xe5\x90\x8d"
   > # (byte, width) = (7, 7): odd width is good for alignment test
@@ -21,14 +22,17 @@
   > command = registrar.command(cmdtable)
   > 
   > @command(b'showoptlist',
-  >     [('s', 'opt1', '', 'short width'  + ' %(s)s' * 8, '%(s)s'),
-  >     ('m', 'opt2', '', 'middle width' + ' %(m)s' * 8, '%(m)s'),
-  >     ('l', 'opt3', '', 'long width'   + ' %(l)s' * 8, '%(l)s')],
-  >     '')
+  >     [(b's', b'opt1', b'', b'short width'  + (b' ' +%(s)s) * 8, %(s)s),
+  >     (b'm', b'opt2', b'', b'middle width' + (b' ' + %(m)s) * 8, %(m)s),
+  >     (b'l', b'opt3', b'', b'long width'   + (b' ' + %(l)s) * 8, %(l)s)],
+  >     b'')
   > def showoptlist(ui, repo, *pats, **opts):
   >     '''dummy command to show option descriptions'''
   >     return 0
-  > """ % globals())
+  > """ % {b's': pycompat.byterepr(s),
+  >        b'm': pycompat.byterepr(m),
+  >        b'l': pycompat.byterepr(l),
+  >       })
   > f.close()
   > EOF
   $ S=`cat s`