summaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api/module_section
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2023-05-25 08:48:57 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2023-05-25 12:54:09 -0700
commit2238dcc39358353cac21df75c3c3286ab20b8f53 (patch)
tree1bb7ec8d7405ccd7fdb5a8a78d0cf5ef40bcc963 /lldb/test/API/python_api/module_section
parentdaeee56798c51e8f007e8e8e6e677a420b14c9ef (diff)
[NFC][Py Reformat] Reformat python files in lldb
This is an ongoing series of commits that are reformatting our Python code. Reformatting is done with `black` (23.1.0). If you end up having problems merging this commit because you have made changes to a python file, the best way to handle that is to run `git checkout --ours <yourfile>` and then reformat it with black. RFC: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style Differential revision: https://reviews.llvm.org/D151460
Diffstat (limited to 'lldb/test/API/python_api/module_section')
-rw-r--r--lldb/test/API/python_api/module_section/TestModuleAndSection.py32
1 files changed, 13 insertions, 19 deletions
diff --git a/lldb/test/API/python_api/module_section/TestModuleAndSection.py b/lldb/test/API/python_api/module_section/TestModuleAndSection.py
index 377640faf66d..1e30a2850a86 100644
--- a/lldb/test/API/python_api/module_section/TestModuleAndSection.py
+++ b/lldb/test/API/python_api/module_section/TestModuleAndSection.py
@@ -10,10 +10,9 @@ from lldbsuite.test.lldbutil import symbol_type_to_str
class ModuleAndSectionAPIsTestCase(TestBase):
-
# Py3 asserts due to a bug in SWIG. A fix for this was upstreamed into
# SWIG 3.0.8.
- @skipIf(py_version=['>=', (3, 0)], swig_version=['<', (3, 0, 8)])
+ @skipIf(py_version=[">=", (3, 0)], swig_version=["<", (3, 0, 8)])
def test_module_and_section(self):
"""Test module and section APIs."""
self.build()
@@ -37,22 +36,17 @@ class ModuleAndSectionAPIsTestCase(TestBase):
print("Exe module: %s" % str(exe_module))
print("Number of sections: %d" % exe_module.GetNumSections())
print("Number of symbols: %d" % len(exe_module))
- INDENT = ' ' * 4
+ INDENT = " " * 4
INDENT2 = INDENT * 2
for sec in exe_module.section_iter():
print(sec)
- print(
- INDENT +
- "Number of subsections: %d" %
- sec.GetNumSubSections())
+ print(INDENT + "Number of subsections: %d" % sec.GetNumSubSections())
if sec.GetNumSubSections() == 0:
for sym in exe_module.symbol_in_section_iter(sec):
print(INDENT + str(sym))
print(
- INDENT +
- "symbol type: %s" %
- symbol_type_to_str(
- sym.GetType()))
+ INDENT + "symbol type: %s" % symbol_type_to_str(sym.GetType())
+ )
else:
for subsec in sec:
print(INDENT + str(subsec))
@@ -60,10 +54,9 @@ class ModuleAndSectionAPIsTestCase(TestBase):
for sym in exe_module.symbol_in_section_iter(subsec):
print(INDENT2 + str(sym))
print(
- INDENT2 +
- "symbol type: %s" %
- symbol_type_to_str(
- sym.GetType()))
+ INDENT2
+ + "symbol type: %s" % symbol_type_to_str(sym.GetType())
+ )
def test_module_and_section_boundary_condition(self):
"""Test module and section APIs by passing None when it expects a Python string."""
@@ -127,17 +120,17 @@ class ModuleAndSectionAPIsTestCase(TestBase):
print("Exe module: %s" % str(exe_module))
print("Number of compile units: %d" % exe_module.GetNumCompileUnits())
- INDENT = ' ' * 4
+ INDENT = " " * 4
INDENT2 = INDENT * 2
for cu in exe_module.compile_unit_iter():
print(cu)
def test_find_compile_units(self):
"""Exercise SBModule.FindCompileUnits() API."""
- d = {'EXE': 'b.out'}
+ d = {"EXE": "b.out"}
self.build(dictionary=d)
self.setTearDownCleanup(dictionary=d)
- self.find_compile_units(self.getBuildArtifact('b.out'))
+ self.find_compile_units(self.getBuildArtifact("b.out"))
def find_compile_units(self, exe):
"""Exercise SBModule.FindCompileUnits() API."""
@@ -154,4 +147,5 @@ class ModuleAndSectionAPIsTestCase(TestBase):
list = module.FindCompileUnits(lldb.SBFileSpec(source_name, False))
for sc in list:
self.assertEqual(
- sc.GetCompileUnit().GetFileSpec().GetFilename(), source_name)
+ sc.GetCompileUnit().GetFileSpec().GetFilename(), source_name
+ )