Mercurial > hg
comparison tests/test-parseindex2.py @ 20166:7eda5bb9ec8f
parsers: clarify documentation of test-parseindex2.py
This change updates and improves the description of test-parseindex2.py.
In particular, it removes language that can be interpreted to mean that the
test module checks only the C implementation of parsers.parse_index2().
Rather, the module checks parsers.parse_index2(), which can be either the
C or pure Python implementation, depending on which version is being used.
As of e57c532c3835, the module also does more than just compare the return
value with the original Python implementation.
author | Chris Jerdonek <chris.jerdonek@gmail.com> |
---|---|
date | Mon, 02 Dec 2013 07:49:49 -0800 |
parents | 96b2dd77c85d |
children | 3681de20b0a7 |
comparison
equal
deleted
inserted
replaced
20165:1c92524c37cd | 20166:7eda5bb9ec8f |
---|---|
1 """This unit test tests parsers.parse_index2().""" | |
2 | |
1 from mercurial import parsers | 3 from mercurial import parsers |
2 from mercurial.node import nullid, nullrev | 4 from mercurial.node import nullid, nullrev |
3 import struct | 5 import struct |
4 | |
5 # This unit test compares the return value of the original Python | |
6 # implementation of parseindex and the new C implementation for | |
7 # an index file with and without inlined data | |
8 | 6 |
9 # original python implementation | 7 # original python implementation |
10 def gettype(q): | 8 def gettype(q): |
11 return int(q & 0xFFFF) | 9 return int(q & 0xFFFF) |
12 | 10 |
104 except TypeError: | 102 except TypeError: |
105 pass | 103 pass |
106 else: | 104 else: |
107 print "Expected to get TypeError." | 105 print "Expected to get TypeError." |
108 | 106 |
107 # Check parsers.parse_index2() on an index file against the original | |
108 # Python implementation of parseindex, both with and without inlined data. | |
109 | |
109 py_res_1 = py_parseindex(data_inlined, True) | 110 py_res_1 = py_parseindex(data_inlined, True) |
110 c_res_1 = parse_index2(data_inlined, True) | 111 c_res_1 = parse_index2(data_inlined, True) |
111 | 112 |
112 py_res_2 = py_parseindex(data_non_inlined, False) | 113 py_res_2 = py_parseindex(data_non_inlined, False) |
113 c_res_2 = parse_index2(data_non_inlined, False) | 114 c_res_2 = parse_index2(data_non_inlined, False) |