changeset 38112:ce307af030a2

py3: use print as a function in tests/test-parseindex.t Differential Revision: https://phab.mercurial-scm.org/D3603
author Pulkit Goyal <7895pulkit@gmail.com>
date Sat, 19 May 2018 18:42:18 +0530
parents 549e970397b2
children 0a10f142299d
files tests/test-parseindex.t
diffstat 1 files changed, 22 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-parseindex.t	Sat May 19 18:41:02 2018 +0530
+++ b/tests/test-parseindex.t	Sat May 19 18:42:18 2018 +0530
@@ -26,6 +26,7 @@
   summary:     change foo
   
   $ cat >> test.py << EOF
+  > from __future__ import print_function
   > from mercurial import changelog, vfs
   > from mercurial.node import *
   > 
@@ -56,9 +57,9 @@
   >     return wrapper
   > 
   > cl = changelog.changelog(opener('.hg/store'))
-  > print len(cl), 'revisions:'
+  > print(len(cl), 'revisions:')
   > for r in cl:
-  >     print short(cl.node(r))
+  >     print(short(cl.node(r)))
   > EOF
   $ $PYTHON test.py
   2 revisions:
@@ -74,33 +75,34 @@
   $ cd a
 
   $ $PYTHON <<EOF
+  > from __future__ import print_function
   > from mercurial import changelog, vfs
   > cl = changelog.changelog(vfs.vfs('.hg/store'))
-  > print 'good heads:'
+  > print('good heads:')
   > for head in [0, len(cl) - 1, -1]:
-  >     print'%s: %r' % (head, cl.reachableroots(0, [head], [0]))
-  > print 'bad heads:'
+  >     print('%s: %r' % (head, cl.reachableroots(0, [head], [0])))
+  > print('bad heads:')
   > for head in [len(cl), 10000, -2, -10000, None]:
-  >     print '%s:' % head,
+  >     print('%s:' % head, end=' ')
   >     try:
   >         cl.reachableroots(0, [head], [0])
-  >         print 'uncaught buffer overflow?'
+  >         print('uncaught buffer overflow?')
   >     except (IndexError, TypeError) as inst:
-  >         print inst
-  > print 'good roots:'
+  >         print(inst)
+  > print('good roots:')
   > for root in [0, len(cl) - 1, -1]:
-  >     print '%s: %r' % (root, cl.reachableroots(root, [len(cl) - 1], [root]))
-  > print 'out-of-range roots are ignored:'
+  >     print('%s: %r' % (root, cl.reachableroots(root, [len(cl) - 1], [root])))
+  > print('out-of-range roots are ignored:')
   > for root in [len(cl), 10000, -2, -10000]:
-  >     print '%s: %r' % (root, cl.reachableroots(root, [len(cl) - 1], [root]))
-  > print 'bad roots:'
+  >     print('%s: %r' % (root, cl.reachableroots(root, [len(cl) - 1], [root])))
+  > print('bad roots:')
   > for root in [None]:
-  >     print '%s:' % root,
+  >     print('%s:' % root, end=' ')
   >     try:
   >         cl.reachableroots(root, [len(cl) - 1], [root])
-  >         print 'uncaught error?'
+  >         print('uncaught error?')
   >     except TypeError as inst:
-  >         print inst
+  >         print(inst)
   > EOF
   good heads:
   0: [0]
@@ -164,6 +166,7 @@
         1       2        1       -1    base         66         65         66   1.01538        66         0    0.00000
 
   $ cat <<EOF > test.py
+  > from __future__ import print_function
   > import sys
   > from mercurial import changelog, vfs
   > cl = changelog.changelog(vfs.vfs(sys.argv[1]))
@@ -177,12 +180,12 @@
   >     ('find_deepest', lambda: cl.ancestor(n0, n1)),
   >     ]
   > for l, f in ops:
-  >     print l + ':',
+  >     print(l + ':', end=' ')
   >     try:
   >         f()
-  >         print 'uncaught buffer overflow?'
+  >         print('uncaught buffer overflow?')
   >     except ValueError, inst:
-  >         print inst
+  >         print(inst)
   > EOF
 
   $ $PYTHON test.py limit/.hg/store