py3: replace file() with open() in test-mactext.t
authorPulkit Goyal <7895pulkit@gmail.com>
Sun, 11 Feb 2018 17:07:09 +0530
changeset 36023 adec6374a0b2
parent 36022 b911995040f9
child 36024 2a81ed6c3bb9
py3: replace file() with open() in test-mactext.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/D2122
tests/test-mactext.t
--- a/tests/test-mactext.t	Sun Feb 11 17:06:04 2018 +0530
+++ b/tests/test-mactext.t	Sun Feb 11 17:07:09 2018 +0530
@@ -3,9 +3,9 @@
   > import sys
   > 
   > for path in sys.argv[1:]:
-  >     data = file(path, 'rb').read()
-  >     data = data.replace('\n', '\r')
-  >     file(path, 'wb').write(data)
+  >     data = open(path, 'rb').read()
+  >     data = data.replace(b'\n', b'\r')
+  >     open(path, 'wb').write(data)
   > EOF
   $ cat > print.py <<EOF
   > import sys