From patchwork Thu Mar 1 14:17:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [8, of, 8] py3: fix test-command-template.t to write files in binary mode From: Yuya Nishihara X-Patchwork-Id: 28555 Message-Id: <717456ce5b08656f1c72.1519913835@mimosa> To: mercurial-devel@mercurial-scm.org Date: Thu, 01 Mar 2018 09:17:15 -0500 # HG changeset patch # User Yuya Nishihara # Date 1519912539 18000 # Thu Mar 01 08:55:39 2018 -0500 # Node ID 717456ce5b08656f1c724de8d82a835ce9ba4d48 # Parent ebde1b7aba4b59b417369b550989dfd7c7e449c2 py3: fix test-command-template.t to write files in binary mode diff --git a/tests/test-command-template.t b/tests/test-command-template.t --- a/tests/test-command-template.t +++ b/tests/test-command-template.t @@ -2217,9 +2217,9 @@ Age filter: >>> from __future__ import absolute_import >>> import datetime - >>> fp = open('a', 'w') + >>> fp = open('a', 'wb') >>> n = datetime.datetime.now() + datetime.timedelta(366 * 7) - >>> fp.write('%d-%d-%d 00:00' % (n.year, n.month, n.day)) + >>> fp.write(b'%d-%d-%d 00:00' % (n.year, n.month, n.day)) >>> fp.close() $ hg add a $ hg commit -m future -d "`cat a`" @@ -4573,8 +4573,8 @@ Set up repository for non-ascii encoding $ hg init nonascii $ cd nonascii $ $PYTHON < open('latin1', 'w').write('\xe9') - > open('utf-8', 'w').write('\xc3\xa9') + > open('latin1', 'wb').write(b'\xe9') + > open('utf-8', 'wb').write(b'\xc3\xa9') > EOF $ HGENCODING=utf-8 hg branch -q `cat utf-8` $ HGENCODING=utf-8 hg ci -qAm "non-ascii branch: `cat utf-8`" utf-8