Mercurial > hg-stable
changeset 28931:ba0e4789bd2e
tests: make test-lrucachedict use print_function
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sat, 16 Apr 2016 03:22:45 +0530 |
parents | e3f01188d439 |
children | 4eac86331acb |
files | tests/test-check-py3-compat.t tests/test-lrucachedict.py |
diffstat | 2 files changed, 7 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-check-py3-compat.t Sat Apr 16 03:10:41 2016 +0530 +++ b/tests/test-check-py3-compat.t Sat Apr 16 03:22:45 2016 +0530 @@ -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
--- a/tests/test-lrucachedict.py Sat Apr 16 03:10:41 2016 +0530 +++ b/tests/test-lrucachedict.py Sat Apr 16 03:22:45 2016 +0530 @@ -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()