changeset 28734:4e51f9d1683e

py3: use print_function in test-bdiff.py
author Robert Stanca <robert.stanca7@gmail.com>
date Sun, 03 Apr 2016 06:16:17 +0300
parents 2e54aaa65afc
children 5edde05ff58e
files tests/test-bdiff.py tests/test-check-py3-compat.t
diffstat 2 files changed, 12 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- 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")
--- 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
@@ -250,7 +249,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)