Patchwork D3603: py3: use print as a function in tests/test-parseindex.t

login
register
mail settings
Submitter phabricator
Date May 19, 2018, 7:39 p.m.
Message ID <d4aaaf3daff25bc01c93d611f040e233@localhost.localdomain>
Download mbox | patch
Permalink /patch/31725/
State Not Applicable
Headers show

Comments

phabricator - May 19, 2018, 7:39 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGce307af030a2: py3: use print as a function in tests/test-parseindex.t (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3603?vs=8774&id=8808

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

AFFECTED FILES
  tests/test-parseindex.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-parseindex.t b/tests/test-parseindex.t
--- a/tests/test-parseindex.t
+++ b/tests/test-parseindex.t
@@ -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