aboutsummaryrefslogtreecommitdiff
path: root/googletest/test/gtest_xml_test_utils.py
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@google.com>2023-01-26 11:05:38 -0800
committerCopybara-Service <copybara-worker@google.com>2023-01-26 11:06:14 -0800
commit403a968d3c1e1de1232ba1c1a2775b74b9ea5579 (patch)
tree753faf7acb51a024173db39944f59b26dc59f641 /googletest/test/gtest_xml_test_utils.py
parent0194f90d0e7118d44f0e3b0750eb69035811e2b8 (diff)
downloadgoogletest-403a968d3c1e1de1232ba1c1a2775b74b9ea5579.zip
googletest-403a968d3c1e1de1232ba1c1a2775b74b9ea5579.tar.gz
googletest-403a968d3c1e1de1232ba1c1a2775b74b9ea5579.tar.bz2
Fix formatting in Python files
PiperOrigin-RevId: 504890435 Change-Id: Ia9a89d0d7a07fe70c12f7f0202c8256c94d2f118
Diffstat (limited to 'googletest/test/gtest_xml_test_utils.py')
-rwxr-xr-xgoogletest/test/gtest_xml_test_utils.py27
1 files changed, 16 insertions, 11 deletions
diff --git a/googletest/test/gtest_xml_test_utils.py b/googletest/test/gtest_xml_test_utils.py
index 567a314..caa77b5 100755
--- a/googletest/test/gtest_xml_test_utils.py
+++ b/googletest/test/gtest_xml_test_utils.py
@@ -35,10 +35,9 @@ from googletest.test import gtest_test_utils
GTEST_DEFAULT_OUTPUT_FILE = 'test_detail.xml'
+
class GTestXMLTestCase(gtest_test_utils.TestCase):
- """
- Base class for tests of Google Test's XML output functionality.
- """
+ """Base class for tests of Google Test's XML output functionality."""
def AssertEquivalentNodes(self, expected_node, actual_node):
"""Asserts that actual_node is equivalent to expected_node.
@@ -165,15 +164,19 @@ class GTestXMLTestCase(gtest_test_utils.TestCase):
'Encountered unknown element <%s>' % child.tagName,
)
child_id = child.getAttribute(
- self.identifying_attribute[child.tagName])
+ self.identifying_attribute[child.tagName]
+ )
self.assertNotIn(child_id, children)
children[child_id] = child
elif child.nodeType in [Node.TEXT_NODE, Node.CDATA_SECTION_NODE]:
if 'detail' not in children:
- if (child.nodeType == Node.CDATA_SECTION_NODE or
- not child.nodeValue.isspace()):
+ if (
+ child.nodeType == Node.CDATA_SECTION_NODE
+ or not child.nodeValue.isspace()
+ ):
children['detail'] = child.ownerDocument.createCDATASection(
- child.nodeValue)
+ child.nodeValue
+ )
else:
children['detail'].nodeValue += child.nodeValue
else:
@@ -210,8 +213,9 @@ class GTestXMLTestCase(gtest_test_utils.TestCase):
source_file.value = re.sub(r'^.*[/\\](.*)', '\\1', source_file.value)
if element.tagName in ('testsuites', 'testsuite', 'testcase'):
timestamp = element.getAttributeNode('timestamp')
- timestamp.value = re.sub(r'^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\d$',
- '*', timestamp.value)
+ timestamp.value = re.sub(
+ r'^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d\d\d$', '*', timestamp.value
+ )
if element.tagName in ('testsuites', 'testsuite', 'testcase'):
time = element.getAttributeNode('time')
time.value = re.sub(r'^\d+(\.\d+)?$', '*', time.value)
@@ -228,8 +232,9 @@ class GTestXMLTestCase(gtest_test_utils.TestCase):
# Replaces the source line information with a normalized form.
cdata = re.sub(source_line_pat, '\\1*\n', child.nodeValue)
# Removes the actual stack trace.
- child.nodeValue = re.sub(r'Stack trace:\n(.|\n)*',
- 'Stack trace:\n*', cdata)
+ child.nodeValue = re.sub(
+ r'Stack trace:\n(.|\n)*', 'Stack trace:\n*', cdata
+ )
for child in element.childNodes:
if child.nodeType == Node.ELEMENT_NODE:
self.NormalizeXml(child)