[PATCH 5 of 8] tests: make test-lrucachedict use print_function

Pulkit Goyal 7895pulkit at gmail.com
Fri Apr 15 18:37:43 EDT 2016


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1460757165 -19800
#      Sat Apr 16 03:22:45 2016 +0530
# Node ID d74af529387f5573de71ec7a6a3c317b84a79884
# Parent  f9bed76becc609b2be733576edd88f064c79afcf
tests: make test-lrucachedict use print_function

diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t
+++ b/tests/test-check-py3-compat.t
@@ -57,7 +57,6 @@
   tests/test-demandimport.py requires print_function
   tests/test-doctest.py not using absolute_import
   tests/test-hgwebdir-paths.py not using absolute_import
-  tests/test-lrucachedict.py requires print_function
   tests/test-trusted.py requires print_function
 
 #if py3exe
@@ -191,7 +190,6 @@
   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-demandimport.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
-  tests/test-lrucachedict.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   tests/test-trusted.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
 
 #endif
diff --git a/tests/test-lrucachedict.py b/tests/test-lrucachedict.py
--- a/tests/test-lrucachedict.py
+++ b/tests/test-lrucachedict.py
@@ -1,4 +1,4 @@
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
 
 from mercurial import (
     util,
@@ -7,9 +7,9 @@
 def printifpresent(d, xs, name='d'):
     for x in xs:
         present = x in d
-        print "'%s' in %s: %s" % (x, name, present)
+        print("'%s' in %s: %s" % (x, name, present))
         if present:
-            print "%s['%s']: %s" % (name, x, d[x])
+            print("%s['%s']: %s" % (name, x, d[x]))
 
 def test_lrucachedict():
     d = util.lrucachedict(4)
@@ -56,19 +56,19 @@
     dc = d.copy()
 
     # all of these should be present
-    print "\nAll of these should be present:"
+    print("\nAll of these should be present:")
     printifpresent(dc, ['a', 'b', 'c', 'd'], 'dc')
 
     # 'a' should be dropped because it was least recently used
-    print "\nAll of these except 'a' should be present:"
+    print("\nAll of these except 'a' should be present:")
     dc['e'] = 've3'
     printifpresent(dc, ['a', 'b', 'c', 'd', 'e'], 'dc')
 
     # contents and order of original dict should remain unchanged
-    print "\nThese should be in reverse alphabetical order and read 'v?3':"
+    print("\nThese should be in reverse alphabetical order and read 'v?3':")
     dc['b'] = 'vb3_new'
     for k in list(iter(d)):
-        print "d['%s']: %s" % (k, d[k])
+        print("d['%s']: %s" % (k, d[k]))
 
 if __name__ == '__main__':
     test_lrucachedict()


More information about the Mercurial-devel mailing list