Patchwork [05,of,11] doctest: pass encoding name as system string

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 4, 2017, 3:08 p.m.
Message ID <d0acccb529936f589ed9.1504537704@mimosa>
Download mbox | patch
Permalink /patch/23660/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 4, 2017, 3:08 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1504420947 -32400
#      Sun Sep 03 15:42:27 2017 +0900
# Node ID d0acccb529936f589ed988f47812ad4963c6c1f0
# Parent  5b0d6647bc5a9d055b29d261738f4251332c70f1
doctest: pass encoding name as system string

Patch

diff --git a/mercurial/encoding.py b/mercurial/encoding.py
--- a/mercurial/encoding.py
+++ b/mercurial/encoding.py
@@ -268,7 +268,7 @@  def trim(s, width, ellipsis='', leftside
     >>> print trim(t, 1, ellipsis=ellipsis)
     +
     >>> u = u'\u3042\u3044\u3046\u3048\u304a' # 2 x 5 = 10 columns
-    >>> t = u.encode(encoding.encoding)
+    >>> t = u.encode(pycompat.sysstr(encoding.encoding))
     >>> print trim(t, 12, ellipsis=ellipsis)
     \xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88\xe3\x81\x8a
     >>> print trim(t, 10, ellipsis=ellipsis)