changeset 28732:e2b118592c63

py3: use print_function in test-batching.py
author Robert Stanca <robert.stanca7@gmail.com>
date Sun, 03 Apr 2016 06:10:52 +0300
parents f8872b507cd3
children 2e54aaa65afc
files tests/test-batching.py tests/test-check-py3-compat.t
diffstat 2 files changed, 16 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-batching.py	Sun Apr 03 06:05:43 2016 +0300
+++ b/tests/test-batching.py	Sun Apr 03 06:10:52 2016 +0300
@@ -5,7 +5,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
 from mercurial.peer import (
     localbatch,
     batchable,
@@ -38,11 +38,11 @@
 def use(it):
 
     # Direct call to base method shared between client and server.
-    print it.hello()
+    print(it.hello())
 
     # Direct calls to proxied methods. They cause individual roundtrips.
-    print it.foo("Un", two="Deux")
-    print it.bar("Eins", "Zwei")
+    print(it.foo("Un", two="Deux"))
+    print(it.bar("Eins", "Zwei"))
 
     # Batched call to a couple of (possibly proxied) methods.
     batch = it.batch()
@@ -60,17 +60,17 @@
     # as possible.
     batch.submit()
     # After the call to submit, the futures actually contain values.
-    print foo.value
-    print foo2.value
-    print bar.value
-    print greet.value
-    print hello.value
-    print bar2.value
+    print(foo.value)
+    print(foo2.value)
+    print(bar.value)
+    print(greet.value)
+    print(hello.value)
+    print(bar2.value)
 
 # local usage
 mylocal = localthing()
-print
-print "== Local"
+print()
+print("== Local")
 use(mylocal)
 
 # demo remoting; mimicks what wireproto and HTTP/SSH do
@@ -100,12 +100,12 @@
         args = dict(arg.split('=', 1) for arg in args)
         return getattr(self, name)(**args)
     def perform(self, req):
-        print "REQ:", req
+        print("REQ:", req)
         name, args = req.split('?', 1)
         args = args.split('&')
         vals = dict(arg.split('=', 1) for arg in args)
         res = getattr(self, name)(**vals)
-        print "  ->", res
+        print("  ->", res)
         return res
     def batch(self, cmds):
         res = []
@@ -178,6 +178,6 @@
 # demo remote usage
 
 myproxy = remotething(myserver)
-print
-print "== Remote"
+print()
+print("== Remote")
 use(myproxy)
--- a/tests/test-check-py3-compat.t	Sun Apr 03 06:05:43 2016 +0300
+++ b/tests/test-check-py3-compat.t	Sun Apr 03 06:10:52 2016 +0300
@@ -53,7 +53,6 @@
   tests/svn-safe-append.py not using absolute_import
   tests/svnxml.py not using absolute_import
   tests/test-atomictempfile.py not using absolute_import
-  tests/test-batching.py requires print_function
   tests/test-bdiff.py not using absolute_import
   tests/test-bdiff.py requires print_function
   tests/test-context.py not using absolute_import
@@ -252,7 +251,6 @@
   mercurial/windows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
   mercurial/wireproto.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
   tests/readlink.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
-  tests/test-batching.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   tests/test-bdiff.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   tests/test-context.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   tests/test-demandimport.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)