##// END OF EJS Templates
tests: move chunks of test-parseindex2.py to use unittest properly...
Augie Fackler -
r39027:22216c46 default
parent child Browse files
Show More
@@ -176,12 +176,8 b' class parseindex2tests(unittest.TestCase'
176
176
177 def testbadargs(self):
177 def testbadargs(self):
178 # Check that parse_index2() raises TypeError on bad arguments.
178 # Check that parse_index2() raises TypeError on bad arguments.
179 try:
179 with self.assertRaises(TypeError):
180 parse_index2(0, True)
180 parse_index2(0, True)
181 except TypeError:
182 pass
183 else:
184 print("Expected to get TypeError.")
185
181
186 def testparseindexfile(self):
182 def testparseindexfile(self):
187 # Check parsers.parse_index2() on an index file against the
183 # Check parsers.parse_index2() on an index file against the
@@ -194,20 +190,17 b' class parseindex2tests(unittest.TestCase'
194 py_res_2 = py_parseindex(data_non_inlined, False)
190 py_res_2 = py_parseindex(data_non_inlined, False)
195 c_res_2 = parse_index2(data_non_inlined, False)
191 c_res_2 = parse_index2(data_non_inlined, False)
196
192
197 if py_res_1 != c_res_1:
193 self.assertEqual(py_res_1, c_res_1) # inline data
198 print("Parse index result (with inlined data) differs!")
194 self.assertEqual(py_res_2, c_res_2) # no inline data
199
200 if py_res_2 != c_res_2:
201 print("Parse index result (no inlined data) differs!")
202
195
203 ix = parsers.parse_index2(data_inlined, True)[0]
196 ix = parsers.parse_index2(data_inlined, True)[0]
204 for i, r in enumerate(ix):
197 for i, r in enumerate(ix):
205 if r[7] == nullid:
198 if r[7] == nullid:
206 i = -1
199 i = -1
207 try:
200 try:
208 if ix[r[7]] != i:
201 self.assertEqual(
209 print('Reverse lookup inconsistent for %r'
202 ix[r[7]], i,
210 % r[7].encode('hex'))
203 'Reverse lookup inconsistent for %r' % r[7].encode('hex'))
211 except TypeError:
204 except TypeError:
212 # pure version doesn't support this
205 # pure version doesn't support this
213 break
206 break
General Comments 0
You need to be logged in to leave comments. Login now