Mercurial > public > mercurial-scm > hg
diff tests/test-lrucachedict.py @ 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 | 79add5a4e857 |
line wrap: on
line diff
--- 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()