##// END OF EJS Templates
py3: use print_function in test-parseindex2.py
Robert Stanca -
r28754:7e5744e8 default
parent child Browse files
Show More
@@ -60,7 +60,6 b''
60 tests/test-lrucachedict.py not using absolute_import
60 tests/test-lrucachedict.py not using absolute_import
61 tests/test-lrucachedict.py requires print_function
61 tests/test-lrucachedict.py requires print_function
62 tests/test-manifest.py not using absolute_import
62 tests/test-manifest.py not using absolute_import
63 tests/test-parseindex2.py requires print_function
64 tests/test-pathencode.py not using absolute_import
63 tests/test-pathencode.py not using absolute_import
65 tests/test-pathencode.py requires print_function
64 tests/test-pathencode.py requires print_function
66 tests/test-propertycache.py not using absolute_import
65 tests/test-propertycache.py not using absolute_import
@@ -234,7 +233,6 b''
234 tests/readlink.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
233 tests/readlink.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
235 tests/test-demandimport.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
234 tests/test-demandimport.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
236 tests/test-lrucachedict.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
235 tests/test-lrucachedict.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
237 tests/test-parseindex*.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
238 tests/test-propertycache.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
236 tests/test-propertycache.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
239 tests/test-revlog-ancestry.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
237 tests/test-revlog-ancestry.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
240 tests/test-status-inprocess.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
238 tests/test-status-inprocess.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
@@ -3,7 +3,7 b''
3 It also checks certain aspects of the parsers module as a whole.
3 It also checks certain aspects of the parsers module as a whole.
4 """
4 """
5
5
6 from __future__ import absolute_import
6 from __future__ import absolute_import, print_function
7 from mercurial import (
7 from mercurial import (
8 parsers,
8 parsers,
9 )
9 )
@@ -128,10 +128,10 b' def printhexfail(testnumber, hexversion,'
128 hexstring = hex(hexversion)
128 hexstring = hex(hexversion)
129 except TypeError:
129 except TypeError:
130 hexstring = None
130 hexstring = None
131 print ("FAILED: version test #%s with Python %s and patched "
131 print("FAILED: version test #%s with Python %s and patched "
132 "sys.hexversion %r (%r):\n Expected %s but got:\n-->'%s'\n" %
132 "sys.hexversion %r (%r):\n Expected %s but got:\n-->'%s'\n" %
133 (testnumber, sys.version_info, hexversion, hexstring, expected,
133 (testnumber, sys.version_info, hexversion, hexstring, expected,
134 stdout))
134 stdout))
135
135
136 def testversionokay(testnumber, hexversion):
136 def testversionokay(testnumber, hexversion):
137 stdout, stderr = importparsers(hexversion)
137 stdout, stderr = importparsers(hexversion)
@@ -176,7 +176,7 b' def runtest() :'
176 except TypeError:
176 except TypeError:
177 pass
177 pass
178 else:
178 else:
179 print "Expected to get TypeError."
179 print("Expected to get TypeError.")
180
180
181 # Check parsers.parse_index2() on an index file against the original
181 # Check parsers.parse_index2() on an index file against the original
182 # Python implementation of parseindex, both with and without inlined data.
182 # Python implementation of parseindex, both with and without inlined data.
@@ -188,10 +188,10 b' def runtest() :'
188 c_res_2 = parse_index2(data_non_inlined, False)
188 c_res_2 = parse_index2(data_non_inlined, False)
189
189
190 if py_res_1 != c_res_1:
190 if py_res_1 != c_res_1:
191 print "Parse index result (with inlined data) differs!"
191 print("Parse index result (with inlined data) differs!")
192
192
193 if py_res_2 != c_res_2:
193 if py_res_2 != c_res_2:
194 print "Parse index result (no inlined data) differs!"
194 print("Parse index result (no inlined data) differs!")
195
195
196 ix = parsers.parse_index2(data_inlined, True)[0]
196 ix = parsers.parse_index2(data_inlined, True)[0]
197 for i, r in enumerate(ix):
197 for i, r in enumerate(ix):
@@ -199,11 +199,12 b' def runtest() :'
199 i = -1
199 i = -1
200 try:
200 try:
201 if ix[r[7]] != i:
201 if ix[r[7]] != i:
202 print 'Reverse lookup inconsistent for %r' % r[7].encode('hex')
202 print('Reverse lookup inconsistent for %r'
203 % r[7].encode('hex'))
203 except TypeError:
204 except TypeError:
204 # pure version doesn't support this
205 # pure version doesn't support this
205 break
206 break
206
207
207 print "done"
208 print("done")
208
209
209 runtest()
210 runtest()
General Comments 0
You need to be logged in to leave comments. Login now