gtest_xml_test_utils.py (googletest-release-1.10.0) | : | gtest_xml_test_utils.py (googletest-release-1.11.0) | ||
---|---|---|---|---|
skipping to change at line 72 | skipping to change at line 72 | |||
if expected_node.nodeType == Node.CDATA_SECTION_NODE: | if expected_node.nodeType == Node.CDATA_SECTION_NODE: | |||
self.assertEquals(Node.CDATA_SECTION_NODE, actual_node.nodeType) | self.assertEquals(Node.CDATA_SECTION_NODE, actual_node.nodeType) | |||
self.assertEquals(expected_node.nodeValue, actual_node.nodeValue) | self.assertEquals(expected_node.nodeValue, actual_node.nodeValue) | |||
return | return | |||
self.assertEquals(Node.ELEMENT_NODE, actual_node.nodeType) | self.assertEquals(Node.ELEMENT_NODE, actual_node.nodeType) | |||
self.assertEquals(Node.ELEMENT_NODE, expected_node.nodeType) | self.assertEquals(Node.ELEMENT_NODE, expected_node.nodeType) | |||
self.assertEquals(expected_node.tagName, actual_node.tagName) | self.assertEquals(expected_node.tagName, actual_node.tagName) | |||
expected_attributes = expected_node.attributes | expected_attributes = expected_node.attributes | |||
actual_attributes = actual_node .attributes | actual_attributes = actual_node.attributes | |||
self.assertEquals( | self.assertEquals( | |||
expected_attributes.length, actual_attributes.length, | expected_attributes.length, actual_attributes.length, | |||
'attribute numbers differ in element %s:\nExpected: %r\nActual: %r' % ( | 'attribute numbers differ in element %s:\nExpected: %r\nActual: %r' % ( | |||
actual_node.tagName, expected_attributes.keys(), | actual_node.tagName, expected_attributes.keys(), | |||
actual_attributes.keys())) | actual_attributes.keys())) | |||
for i in range(expected_attributes.length): | for i in range(expected_attributes.length): | |||
expected_attr = expected_attributes.item(i) | expected_attr = expected_attributes.item(i) | |||
actual_attr = actual_attributes.get(expected_attr.name) | actual_attr = actual_attributes.get(expected_attr.name) | |||
self.assert_( | self.assert_( | |||
actual_attr is not None, | actual_attr is not None, | |||
'expected attribute %s not found in element %s' % | 'expected attribute %s not found in element %s' % | |||
(expected_attr.name, actual_node.tagName)) | (expected_attr.name, actual_node.tagName)) | |||
self.assertEquals( | self.assertEquals( | |||
expected_attr.value, actual_attr.value, | expected_attr.value, actual_attr.value, | |||
' values of attribute %s in element %s differ: %s vs %s' % | ' values of attribute %s in element %s differ: %s vs %s' % | |||
(expected_attr.name, actual_node.tagName, | (expected_attr.name, actual_node.tagName, | |||
expected_attr.value, actual_attr.value)) | expected_attr.value, actual_attr.value)) | |||
skipping to change at line 107 | skipping to change at line 107 | |||
self.assert_(child_id in actual_children, | self.assert_(child_id in actual_children, | |||
'<%s> is not in <%s> (in element %s)' % | '<%s> is not in <%s> (in element %s)' % | |||
(child_id, actual_children, actual_node.tagName)) | (child_id, actual_children, actual_node.tagName)) | |||
self.AssertEquivalentNodes(child, actual_children[child_id]) | self.AssertEquivalentNodes(child, actual_children[child_id]) | |||
identifying_attribute = { | identifying_attribute = { | |||
'testsuites': 'name', | 'testsuites': 'name', | |||
'testsuite': 'name', | 'testsuite': 'name', | |||
'testcase': 'name', | 'testcase': 'name', | |||
'failure': 'message', | 'failure': 'message', | |||
'skipped': 'message', | ||||
'property': 'name', | 'property': 'name', | |||
} | } | |||
def _GetChildren(self, element): | def _GetChildren(self, element): | |||
""" | """ | |||
Fetches all of the child nodes of element, a DOM Element object. | Fetches all of the child nodes of element, a DOM Element object. | |||
Returns them as the values of a dictionary keyed by the IDs of the | Returns them as the values of a dictionary keyed by the IDs of the | |||
children. For <testsuites>, <testsuite>, <testcase>, and <property> | children. For <testsuites>, <testsuite>, <testcase>, and <property> | |||
elements, the ID is the value of their "name" attribute; for <failure> | elements, the ID is the value of their "name" attribute; for <failure> | |||
elements, it is the value of the "message" attribute; for <properties> | elements, it is the value of the "message" attribute; for <properties> | |||
skipping to change at line 173 | skipping to change at line 174 | |||
by the compiler and is platform dependent. | by the compiler and is platform dependent. | |||
* The line info reported in the first line of the "message" | * The line info reported in the first line of the "message" | |||
attribute and CDATA section of <failure> elements is replaced with the | attribute and CDATA section of <failure> elements is replaced with the | |||
file's basename and a single asterisk for the line number. | file's basename and a single asterisk for the line number. | |||
* The directory names in file paths are removed. | * The directory names in file paths are removed. | |||
* The stack traces are removed. | * The stack traces are removed. | |||
""" | """ | |||
if element.tagName in ('testsuites', 'testsuite', 'testcase'): | if element.tagName in ('testsuites', 'testsuite', 'testcase'): | |||
timestamp = element.getAttributeNode('timestamp') | timestamp = element.getAttributeNode('timestamp') | |||
timestamp.value = re.sub(r'^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d$', | timestamp.value = re.sub(r'^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\d$', | |||
'*', timestamp.value) | '*', timestamp.value) | |||
if element.tagName in ('testsuites', 'testsuite', 'testcase'): | if element.tagName in ('testsuites', 'testsuite', 'testcase'): | |||
time = element.getAttributeNode('time') | time = element.getAttributeNode('time') | |||
time.value = re.sub(r'^\d+(\.\d+)?$', '*', time.value) | time.value = re.sub(r'^\d+(\.\d+)?$', '*', time.value) | |||
type_param = element.getAttributeNode('type_param') | type_param = element.getAttributeNode('type_param') | |||
if type_param and type_param.value: | if type_param and type_param.value: | |||
type_param.value = '*' | type_param.value = '*' | |||
elif element.tagName == 'failure': | elif element.tagName == 'failure' or element.tagName == 'skipped': | |||
source_line_pat = r'^.*[/\\](.*:)\d+\n' | source_line_pat = r'^.*[/\\](.*:)\d+\n' | |||
# Replaces the source line information with a normalized form. | # Replaces the source line information with a normalized form. | |||
message = element.getAttributeNode('message') | message = element.getAttributeNode('message') | |||
message.value = re.sub(source_line_pat, '\\1*\n', message.value) | message.value = re.sub(source_line_pat, '\\1*\n', message.value) | |||
for child in element.childNodes: | for child in element.childNodes: | |||
if child.nodeType == Node.CDATA_SECTION_NODE: | if child.nodeType == Node.CDATA_SECTION_NODE: | |||
# Replaces the source line information with a normalized form. | # Replaces the source line information with a normalized form. | |||
cdata = re.sub(source_line_pat, '\\1*\n', child.nodeValue) | cdata = re.sub(source_line_pat, '\\1*\n', child.nodeValue) | |||
# Removes the actual stack trace. | # Removes the actual stack trace. | |||
child.nodeValue = re.sub(r'Stack trace:\n(.|\n)*', | child.nodeValue = re.sub(r'Stack trace:\n(.|\n)*', | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 5 lines changed or added |