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