Patchwork D2127: py3: replace file() with open() in test-fileset.t

login
register
mail settings
Submitter phabricator
Date Feb. 11, 2018, 12:41 p.m.
Message ID <differential-rev-PHID-DREV-ltmy7zzpdwsporfp4mnn-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27542/
State Superseded
Headers show

Comments

phabricator - Feb. 11, 2018, 12:41 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  file() is not present in Python 3.
  This patch also adds a b'' prefix to make sure we write bytes in Python 3.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2127

AFFECTED FILES
  tests/test-fileset.t

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-fileset.t b/tests/test-fileset.t
--- a/tests/test-fileset.t
+++ b/tests/test-fileset.t
@@ -180,7 +180,7 @@ 
 
 Test files properties
 
-  >>> file('bin', 'wb').write('\0a')
+  >>> open('bin', 'wb').write(b'\0a')
   $ fileset 'binary()'
   $ fileset 'binary() and unknown()'
   bin
@@ -219,8 +219,8 @@ 
   $ hg --config ui.portablefilenames=ignore add con.xml
 #endif
 
-  >>> file('1k', 'wb').write(' '*1024)
-  >>> file('2k', 'wb').write(' '*2048)
+  >>> open('1k', 'wb').write(b' '*1024)
+  >>> open('2k', 'wb').write(b' '*2048)
   $ hg add 1k 2k
   $ fileset 'size("bar")'
   hg: parse error: couldn't parse size: bar