##// END OF EJS Templates
tests: make test-lrucachedict use print_function
Pulkit Goyal -
r28931:ba0e4789 default
parent child Browse files
Show More
@@ -57,7 +57,6 b''
57 57 tests/test-demandimport.py requires print_function
58 58 tests/test-doctest.py not using absolute_import
59 59 tests/test-hgwebdir-paths.py not using absolute_import
60 tests/test-lrucachedict.py requires print_function
61 60 tests/test-trusted.py requires print_function
62 61
63 62 #if py3exe
@@ -191,7 +190,6 b''
191 190 mercurial/wireproto.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
192 191 tests/readlink.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
193 192 tests/test-demandimport.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
194 tests/test-lrucachedict.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
195 193 tests/test-trusted.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
196 194
197 195 #endif
@@ -1,4 +1,4 b''
1 from __future__ import absolute_import
1 from __future__ import absolute_import, print_function
2 2
3 3 from mercurial import (
4 4 util,
@@ -7,9 +7,9 b' from mercurial import ('
7 7 def printifpresent(d, xs, name='d'):
8 8 for x in xs:
9 9 present = x in d
10 print "'%s' in %s: %s" % (x, name, present)
10 print("'%s' in %s: %s" % (x, name, present))
11 11 if present:
12 print "%s['%s']: %s" % (name, x, d[x])
12 print("%s['%s']: %s" % (name, x, d[x]))
13 13
14 14 def test_lrucachedict():
15 15 d = util.lrucachedict(4)
@@ -56,19 +56,19 b' def test_lrucachedict():'
56 56 dc = d.copy()
57 57
58 58 # all of these should be present
59 print "\nAll of these should be present:"
59 print("\nAll of these should be present:")
60 60 printifpresent(dc, ['a', 'b', 'c', 'd'], 'dc')
61 61
62 62 # 'a' should be dropped because it was least recently used
63 print "\nAll of these except 'a' should be present:"
63 print("\nAll of these except 'a' should be present:")
64 64 dc['e'] = 've3'
65 65 printifpresent(dc, ['a', 'b', 'c', 'd', 'e'], 'dc')
66 66
67 67 # contents and order of original dict should remain unchanged
68 print "\nThese should be in reverse alphabetical order and read 'v?3':"
68 print("\nThese should be in reverse alphabetical order and read 'v?3':")
69 69 dc['b'] = 'vb3_new'
70 70 for k in list(iter(d)):
71 print "d['%s']: %s" % (k, d[k])
71 print("d['%s']: %s" % (k, d[k]))
72 72
73 73 if __name__ == '__main__':
74 74 test_lrucachedict()
General Comments 0
You need to be logged in to leave comments. Login now