# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 2016-04-15 21:52:45 # Node ID ba0e4789bd2e6716594c3432489142a98fc87079 # Parent e3f01188d439034fe4150bf4ef8f59a44c1f9d75 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: invalid syntax (bundle*.py, line *) (line *) (glob) tests/readlink.py: invalid syntax: invalid syntax (, line *) (glob) tests/test-demandimport.py: invalid syntax: invalid syntax (, line *) (glob) - tests/test-lrucachedict.py: invalid syntax: invalid syntax (, line *) (glob) tests/test-trusted.py: invalid syntax: invalid syntax (, 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 @@ from mercurial import ( 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 @@ def test_lrucachedict(): 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()