py3: replace file() with open() in test-fileset.t
authorPulkit Goyal <7895pulkit@gmail.com>
Sun, 11 Feb 2018 17:12:28 +0530
changeset 36028 f6a8a81f4f7b
parent 36027 d667302b6ee1
child 36029 d83fc41dabf3
py3: replace file() with open() in test-fileset.t file() is not present in Python 3. This patch also adds a b'' prefix to make sure we write bytes in Python 3. Differential Revision: https://phab.mercurial-scm.org/D2127
tests/test-fileset.t
--- a/tests/test-fileset.t	Sun Feb 11 17:11:45 2018 +0530
+++ b/tests/test-fileset.t	Sun Feb 11 17:12:28 2018 +0530
@@ -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