Skip to content

Commit ab85553

Browse files
committed
[lldb] Fix Python test formatting (NFC)
All Python files in the LLVM repository were reformatted with Black [1]. Files inside the LLDB subproject were reformatted in 2238dcc. This patch updates a handful of tests that were added or modified since then and weren't formatted with Black. [1] https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style/68257
1 parent c8c5830 commit ab85553

File tree

9 files changed

+56
-37
lines changed

9 files changed

+56
-37
lines changed

lldb/test/API/commands/dwim-print/TestDWIMPrint.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,7 @@ def test_summary_strings(self):
142142
def test_void_result(self):
143143
"""Test dwim-print does not surface an error message for void expressions."""
144144
self.build()
145-
lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.c"))
145+
lldbutil.run_to_source_breakpoint(
146+
self, "// break here", lldb.SBFileSpec("main.c")
147+
)
146148
self.expect("dwim-print (void)15", matching=False, patterns=["(?i)error"])

lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_step_over_with_python_api(self):
2525
self.build()
2626
self.inline_stepping_step_over()
2727

28-
@add_test_categories(['pyapi'])
28+
@add_test_categories(["pyapi"])
2929
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343")
3030
def test_step_in_template_with_python_api(self):
3131
"""Test stepping in to templated functions."""

lldb/test/API/functionalities/step-avoids-no-debug/TestStepNoDebug.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010

1111

1212
class StepAvoidsNoDebugTestCase(TestBase):
13-
14-
@add_test_categories(['pyapi'])
15-
@expectedFailureAll(archs=["aarch64"], oslist=["windows"], bugnumber="llvm.org/pr56292")
13+
@add_test_categories(["pyapi"])
14+
@expectedFailureAll(
15+
archs=["aarch64"], oslist=["windows"], bugnumber="llvm.org/pr56292"
16+
)
1617
def test_step_out_with_python(self):
1718
"""Test stepping out using avoid-no-debug with dsyms."""
1819
self.build()
@@ -26,8 +27,11 @@ def test_step_out_with_python(self):
2627
compiler_version=[">=", "3.9"],
2728
archs=["i386"],
2829
oslist=no_match(["freebsd"]),
29-
bugnumber="llvm.org/pr28549")
30-
@expectedFailureAll(archs=["aarch64"], oslist=["windows"], bugnumber="llvm.org/pr56292")
30+
bugnumber="llvm.org/pr28549",
31+
)
32+
@expectedFailureAll(
33+
archs=["aarch64"], oslist=["windows"], bugnumber="llvm.org/pr56292"
34+
)
3135
def test_step_over_with_python(self):
3236
"""Test stepping over using avoid-no-debug with dwarf."""
3337
self.build()
@@ -41,8 +45,11 @@ def test_step_over_with_python(self):
4145
compiler_version=[">=", "3.9"],
4246
archs=["i386"],
4347
oslist=no_match(["freebsd"]),
44-
bugnumber="llvm.org/pr28549")
45-
@expectedFailureAll(archs=["aarch64"], oslist=["windows"], bugnumber="llvm.org/pr56292")
48+
bugnumber="llvm.org/pr28549",
49+
)
50+
@expectedFailureAll(
51+
archs=["aarch64"], oslist=["windows"], bugnumber="llvm.org/pr56292"
52+
)
4653
def test_step_in_with_python(self):
4754
"""Test stepping in using avoid-no-debug with dwarf."""
4855
self.build()

lldb/test/API/functionalities/var_path/TestVarPath.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,6 @@ def do_test(self):
118118
# in type with synthetic children. This used to cause a crash.
119119
if not self.isAArch64Windows():
120120
v = frame.GetValueForVariablePath("pt_sp->not_valid_child")
121-
self.assertTrue(v.GetError().Fail(),
122-
"Make sure we don't find 'pt_sp->not_valid_child'")
121+
self.assertTrue(
122+
v.GetError().Fail(), "Make sure we don't find 'pt_sp->not_valid_child'"
123+
)

lldb/test/API/lang/cpp/class_static/TestStaticVariables.py

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,23 @@ def test_with_run_command_complete(self):
107107
)
108108

109109
def build_value_check(self, var_name, values):
110-
children_1 = [ValueCheck(name = "x", value = values[0], type = "int"),
111-
ValueCheck(name = "y", value = values[1], type = "int")]
112-
children_2 = [ValueCheck(name = "x", value = values[2], type = "int"),
113-
ValueCheck(name = "y", value = values[3], type = "int")]
114-
elem_0 = ValueCheck(name = "[0]", value=None, type = "PointType",
115-
children=children_1)
116-
elem_1 = ValueCheck(name = "[1]", value=None, type = "PointType",
117-
children=children_2)
118-
value_check = ValueCheck(name=var_name, value = None, type = "PointType[2]",
119-
children = [elem_0, elem_1])
110+
children_1 = [
111+
ValueCheck(name="x", value=values[0], type="int"),
112+
ValueCheck(name="y", value=values[1], type="int"),
113+
]
114+
children_2 = [
115+
ValueCheck(name="x", value=values[2], type="int"),
116+
ValueCheck(name="y", value=values[3], type="int"),
117+
]
118+
elem_0 = ValueCheck(
119+
name="[0]", value=None, type="PointType", children=children_1
120+
)
121+
elem_1 = ValueCheck(
122+
name="[1]", value=None, type="PointType", children=children_2
123+
)
124+
value_check = ValueCheck(
125+
name=var_name, value=None, type="PointType[2]", children=[elem_0, elem_1]
126+
)
120127

121128
return value_check
122129

@@ -161,7 +168,7 @@ def test_with_python_FindValue(self):
161168
value_check_none = self.build_value_check("g_points", ["3", "4", "33", "44"])
162169
value_check_AA = self.build_value_check("AA::g_points", ["5", "6", "55", "66"])
163170

164-
for val in valList:
171+
for val in valList:
165172
self.DebugSBValue(val)
166173
name = val.GetName()
167174
self.assertIn(name, ["g_points", "A::g_points", "AA::g_points"])
@@ -252,17 +259,18 @@ def test_with_python_FindGlobalVariables(self):
252259
elif name == "AA::g_points":
253260
value_check_AA.check_value(self, val, "A found by regex")
254261
found_aa = True
255-
262+
256263
self.assertTrue(found_a, "Regex search found A::g_points")
257264
self.assertTrue(found_aa, "Regex search found AA::g_points")
258265

259266
# Normal search for full name should find one, but it looks like we don't match
260267
# on identifier boundaries here yet:
261268
val_list = target.FindGlobalVariables("A::g_points", 10, lldb.eMatchTypeNormal)
262-
self.assertEqual(val_list.GetSize(), 2, "We aren't matching on name boundaries yet")
269+
self.assertEqual(
270+
val_list.GetSize(), 2, "We aren't matching on name boundaries yet"
271+
)
263272

264273
# Normal search for g_points should find 3 - FindGlobalVariables doesn't distinguish
265274
# between file statics and globals:
266275
val_list = target.FindGlobalVariables("g_points", 10, lldb.eMatchTypeNormal)
267276
self.assertEqual(val_list.GetSize(), 3, "Found all three g_points")
268-

lldb/test/API/lang/cpp/frame-var-depth-and-elem-count/TestFrameVarDepthAndElemCount.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ def test(self):
1616
)
1717

1818
# Check that we print 5 elements but only 2 levels deep.
19-
self.expect('frame var --depth 2 --element-count 5 -- c',
20-
substrs=[
21-
'[0] = {\n b ={...}\n }',
22-
'[1] = {\n b ={...}\n }',
23-
'[2] = {\n b ={...}\n }',
24-
'[3] = {\n b ={...}\n }',
25-
'[4] = {\n b ={...}\n }',
26-
])
27-
19+
self.expect(
20+
"frame var --depth 2 --element-count 5 -- c",
21+
substrs=[
22+
"[0] = {\n b ={...}\n }",
23+
"[1] = {\n b ={...}\n }",
24+
"[2] = {\n b ={...}\n }",
25+
"[3] = {\n b ={...}\n }",
26+
"[4] = {\n b ={...}\n }",
27+
],
28+
)

lldb/test/API/python_api/function_symbol/TestDisasmAPI.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def setUp(self):
2020
"main.c", "// Find the line number for breakpoint 2 here."
2121
)
2222

23-
@expectedFailureAll(oslist=["windows"], bugnumber='llvm.org/pr21765')
23+
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
2424
def test(self):
2525
"""Exercise getting SBAddress objects, disassembly, and SBAddress APIs."""
2626
self.build()

lldb/test/API/python_api/function_symbol/TestSymbolAPI.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def setUp(self):
2020
"main.c", "// Find the line number for breakpoint 2 here."
2121
)
2222

23-
@expectedFailureAll(oslist=["windows"], bugnumber='llvm.org/pr21765')
23+
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
2424
def test(self):
2525
"""Exercise some SBSymbol and SBAddress APIs."""
2626
self.build()

lldb/test/API/python_api/target/TestTargetAPI.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def test_get_description(self):
5555
self.build()
5656
self.get_description()
5757

58-
@expectedFailureAll(oslist=["windows"], bugnumber='llvm.org/pr21765')
58+
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
5959
def test_resolve_symbol_context_with_address(self):
6060
"""Exercise SBTarget.ResolveSymbolContextForAddress() API."""
6161
self.build()

0 commit comments

Comments
 (0)