Patchwork [4,of,6,V3] tests: use print_function in test-bdiff.py

login
register
mail settings
Submitter roby roby
Date April 3, 2016, 3:52 a.m.
Message ID <edfd053def76c6c49eed.1459655543@roby>
Download mbox | patch
Permalink /patch/14270/
State Accepted
Headers show

Comments

roby roby - April 3, 2016, 3:52 a.m.
# HG changeset patch
# User Robert Stanca <robert.stanca7@gmail.com>
# Date 1459653377 -10800
#      Sun Apr 03 06:16:17 2016 +0300
# Node ID edfd053def76c6c49eedad027adde540cd632b1c
# Parent  640b56db342f84eaac81abeb42a214c92ea7c55a
tests: use print_function in test-bdiff.py

Patch

diff -r 640b56db342f -r edfd053def76 tests/test-bdiff.py
--- a/tests/test-bdiff.py	Sun Apr 03 06:12:18 2016 +0300
+++ b/tests/test-bdiff.py	Sun Apr 03 06:16:17 2016 +0300
@@ -1,4 +1,4 @@ 
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
 import struct
 from mercurial import (
     bdiff,
@@ -11,13 +11,13 @@ 
     if d:
         c = mpatch.patches(a, [d])
     if c != b:
-        print "***", repr(a), repr(b)
-        print "bad:"
-        print repr(c)[:200]
-        print repr(d)
+        print("***", repr(a), repr(b))
+        print("bad:")
+        print(repr(c)[:200])
+        print(repr(d))
 
 def test(a, b):
-    print "***", repr(a), repr(b)
+    print("***", repr(a), repr(b))
     test1(a, b)
     test1(b, a)
 
@@ -48,23 +48,23 @@ 
     while pos < len(bin):
         p1, p2, l = struct.unpack(">lll", bin[pos:pos + 12])
         pos += 12
-        print p1, p2, repr(bin[pos:pos + l])
+        print(p1, p2, repr(bin[pos:pos + l]))
         pos += l
 showdiff("x\n\nx\n\nx\n\nx\n\nz\n", "x\n\nx\n\ny\n\nx\n\nx\n\nz\n")
 showdiff("x\n\nx\n\nx\n\nx\n\nz\n", "x\n\nx\n\ny\n\nx\n\ny\n\nx\n\nz\n")
 
-print "done"
+print("done")
 
 def testfixws(a, b, allws):
     c = bdiff.fixws(a, allws)
     if c != b:
-        print "*** fixws", repr(a), repr(b), allws
-        print "got:"
-        print repr(c)
+        print("*** fixws", repr(a), repr(b), allws)
+        print("got:")
+        print(repr(c))
 
 testfixws(" \ta\r b\t\n", "ab\n", 1)
 testfixws(" \ta\r b\t\n", " a b\n", 0)
 testfixws("", "", 1)
 testfixws("", "", 0)
 
-print "done"
+print("done")
diff -r 640b56db342f -r edfd053def76 tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t	Sun Apr 03 06:12:18 2016 +0300
+++ b/tests/test-check-py3-compat.t	Sun Apr 03 06:16:17 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-bdiff.py requires print_function
   tests/test-context.py not using absolute_import
   tests/test-context.py requires print_function
   tests/test-demandimport.py not using absolute_import
@@ -225,7 +224,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-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)
   tests/test-duplicateoptions.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)