Skip to content

Commit 80fcecb

Browse files
authored
[lldb] Replace assertEquals with assertEqual (NFC) (llvm#82073)
assertEquals is a deprecated alias for assertEqual and has been removed in Python 3.12. This wasn't an issue previously because we used a vendored version of the unittest module. Now that we use the built-in version this gets updated together with the Python version used to run the test suite.
1 parent 8443ce5 commit 80fcecb

File tree

111 files changed

+426
-426
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+426
-426
lines changed

lldb/packages/Python/lldbsuite/test/lldbutil.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -696,24 +696,24 @@ def check_breakpoint(
696696
test.assertTrue(bkpt.IsValid(), "Breakpoint is not valid.")
697697

698698
if expected_locations is not None:
699-
test.assertEquals(expected_locations, bkpt.GetNumLocations())
699+
test.assertEqual(expected_locations, bkpt.GetNumLocations())
700700

701701
if expected_resolved_count is not None:
702-
test.assertEquals(expected_resolved_count, bkpt.GetNumResolvedLocations())
702+
test.assertEqual(expected_resolved_count, bkpt.GetNumResolvedLocations())
703703
else:
704704
expected_resolved_count = bkpt.GetNumLocations()
705705
if location_id is None:
706-
test.assertEquals(expected_resolved_count, bkpt.GetNumResolvedLocations())
706+
test.assertEqual(expected_resolved_count, bkpt.GetNumResolvedLocations())
707707

708708
if expected_hit_count is not None:
709-
test.assertEquals(expected_hit_count, bkpt.GetHitCount())
709+
test.assertEqual(expected_hit_count, bkpt.GetHitCount())
710710

711711
if location_id is not None:
712712
loc_bkpt = bkpt.FindLocationByID(location_id)
713713
test.assertTrue(loc_bkpt.IsValid(), "Breakpoint location is not valid.")
714-
test.assertEquals(loc_bkpt.IsResolved(), expected_location_resolved)
714+
test.assertEqual(loc_bkpt.IsResolved(), expected_location_resolved)
715715
if expected_location_hit_count is not None:
716-
test.assertEquals(expected_location_hit_count, loc_bkpt.GetHitCount())
716+
test.assertEqual(expected_location_hit_count, loc_bkpt.GetHitCount())
717717

718718

719719
# ==================================================

lldb/test/API/commands/disassemble/basic/TestFrameDisassemble.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def frame_disassemble_test(self):
4848
)
4949

5050
# The hit count for the breakpoint should be 1.
51-
self.assertEquals(breakpoint.GetHitCount(), 1)
51+
self.assertEqual(breakpoint.GetHitCount(), 1)
5252

5353
frame = threads[0].GetFrameAtIndex(0)
5454
disassembly = frame.Disassemble()

lldb/test/API/commands/expression/call-restarts/TestCallThatRestarts.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def call_function(self):
7575
value = frame.EvaluateExpression("call_me (%d)" % (num_sigchld), options)
7676
self.assertTrue(value.IsValid())
7777
self.assertSuccess(value.GetError())
78-
self.assertEquals(value.GetValueAsSigned(-1), num_sigchld)
78+
self.assertEqual(value.GetValueAsSigned(-1), num_sigchld)
7979

8080
self.check_after_call(num_sigchld)
8181

@@ -92,7 +92,7 @@ def call_function(self):
9292

9393
self.assertTrue(value.IsValid())
9494
self.assertSuccess(value.GetError())
95-
self.assertEquals(value.GetValueAsSigned(-1), num_sigchld)
95+
self.assertEqual(value.GetValueAsSigned(-1), num_sigchld)
9696
self.check_after_call(num_sigchld)
9797

9898
# Now set the signal to print but not stop and make sure that calling
@@ -103,7 +103,7 @@ def call_function(self):
103103

104104
self.assertTrue(value.IsValid())
105105
self.assertSuccess(value.GetError())
106-
self.assertEquals(value.GetValueAsSigned(-1), num_sigchld)
106+
self.assertEqual(value.GetValueAsSigned(-1), num_sigchld)
107107
self.check_after_call(num_sigchld)
108108

109109
# Now set this unwind on error to false, and make sure that we still
@@ -113,7 +113,7 @@ def call_function(self):
113113

114114
self.assertTrue(value.IsValid())
115115
self.assertSuccess(value.GetError())
116-
self.assertEquals(value.GetValueAsSigned(-1), num_sigchld)
116+
self.assertEqual(value.GetValueAsSigned(-1), num_sigchld)
117117
self.check_after_call(num_sigchld)
118118

119119
# Okay, now set UnwindOnError to true, and then make the signal behavior to stop

lldb/test/API/commands/expression/call-throws/TestCallThatThrows.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def call_function(self):
4646

4747
value = frame.EvaluateExpression("[my_class callMeIThrow]", options)
4848
self.assertTrue(value.IsValid())
49-
self.assertEquals(value.GetError().Success(), False)
49+
self.assertEqual(value.GetError().Success(), False)
5050

5151
self.check_after_call()
5252

@@ -86,7 +86,7 @@ def call_function(self):
8686
value = frame.EvaluateExpression("[my_class iCatchMyself]", options)
8787
self.assertTrue(value.IsValid())
8888
self.assertSuccess(value.GetError())
89-
self.assertEquals(value.GetValueAsUnsigned(), 57)
89+
self.assertEqual(value.GetValueAsUnsigned(), 57)
9090
self.check_after_call()
9191
options.SetTrapExceptions(True)
9292

lldb/test/API/commands/expression/completion/TestExprCompletion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ def assume_no_completions(self, str_input, cursor_pos=None):
305305
for m in match_strings:
306306
available_completions.append(m)
307307

308-
self.assertEquals(
308+
self.assertEqual(
309309
num_matches,
310310
0,
311311
"Got matches, but didn't expect any: " + str(available_completions),

lldb/test/API/commands/expression/fixits/TestFixIts.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_with_target(self):
4646
value = frame.EvaluateExpression("my_pointer.first", options)
4747
self.assertTrue(value.IsValid())
4848
self.assertSuccess(value.GetError())
49-
self.assertEquals(value.GetValueAsUnsigned(), 10)
49+
self.assertEqual(value.GetValueAsUnsigned(), 10)
5050

5151
# Try with one error in a top-level expression.
5252
# The Fix-It changes "ptr.m" to "ptr->m".
@@ -56,22 +56,22 @@ def test_with_target(self):
5656
# unknown error . If a parsing error would have happened we
5757
# would get a different error kind, so let's check the error
5858
# kind here.
59-
self.assertEquals(value.GetError().GetCString(), "unknown error")
59+
self.assertEqual(value.GetError().GetCString(), "unknown error")
6060

6161
# Try with two errors:
6262
two_error_expression = "my_pointer.second->a"
6363
value = frame.EvaluateExpression(two_error_expression, options)
6464
self.assertTrue(value.IsValid())
6565
self.assertSuccess(value.GetError())
66-
self.assertEquals(value.GetValueAsUnsigned(), 20)
66+
self.assertEqual(value.GetValueAsUnsigned(), 20)
6767

6868
# Try a Fix-It that is stored in the 'note:' diagnostic of an error.
6969
# The Fix-It here is adding parantheses around the ToStr parameters.
7070
fixit_in_note_expr = "#define ToStr(x) #x\nToStr(0 {, })"
7171
value = frame.EvaluateExpression(fixit_in_note_expr, options)
7272
self.assertTrue(value.IsValid())
7373
self.assertSuccess(value.GetError())
74-
self.assertEquals(value.GetSummary(), '"(0 {, })"')
74+
self.assertEqual(value.GetSummary(), '"(0 {, })"')
7575

7676
# Now turn off the fixits, and the expression should fail:
7777
options.SetAutoApplyFixIts(False)
@@ -178,7 +178,7 @@ def test_with_multiple_retries(self):
178178
multiple_runs_options.SetRetriesWithFixIts(2)
179179
value = frame.EvaluateExpression(two_runs_expr, multiple_runs_options)
180180
# This error signals success for top level expressions.
181-
self.assertEquals(value.GetError().GetCString(), "unknown error")
181+
self.assertEqual(value.GetError().GetCString(), "unknown error")
182182

183183
# Test that the code above compiles to the right thing.
184184
self.expect_expr("test_X(1)", result_type="int", result_value="123")

lldb/test/API/commands/expression/save_jit_objects/TestSaveJITObjects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_save_jit_objects(self):
3737

3838
self.cleanJITFiles()
3939
frame.EvaluateExpression("(void*)malloc(0x1)")
40-
self.assertEquals(
40+
self.assertEqual(
4141
self.countJITFiles(), 0, "No files emitted with save-jit-objects-dir empty"
4242
)
4343

lldb/test/API/commands/expression/test/TestExprs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def test_evaluate_expression_python(self):
124124
)
125125

126126
# We should be stopped on the breakpoint with a hit count of 1.
127-
self.assertEquals(breakpoint.GetHitCount(), 1, BREAKPOINT_HIT_ONCE)
127+
self.assertEqual(breakpoint.GetHitCount(), 1, BREAKPOINT_HIT_ONCE)
128128

129129
#
130130
# Use Python API to evaluate expressions while stopped in a stack frame.
@@ -169,15 +169,15 @@ def test_evaluate_expression_python(self):
169169
self.expect(
170170
"expression -i true -- a_function_to_call()", substrs=["(int) $", " 1"]
171171
)
172-
self.assertEquals(callee_break.GetHitCount(), 1)
172+
self.assertEqual(callee_break.GetHitCount(), 1)
173173

174174
# Now try ignoring breakpoints using the SB API's:
175175
options = lldb.SBExpressionOptions()
176176
options.SetIgnoreBreakpoints(True)
177177
value = frame.EvaluateExpression("a_function_to_call()", options)
178178
self.assertTrue(value.IsValid())
179-
self.assertEquals(value.GetValueAsSigned(0), 2)
180-
self.assertEquals(callee_break.GetHitCount(), 2)
179+
self.assertEqual(value.GetValueAsSigned(0), 2)
180+
self.assertEqual(callee_break.GetHitCount(), 2)
181181

182182
# rdar://problem/8686536
183183
# CommandInterpreter::HandleCommand is stripping \'s from input for

lldb/test/API/commands/expression/timeout/TestCallWithTimeout.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test(self):
4646
return_value = interp.HandleCommand(
4747
"expr -t 100 -u true -- wait_a_while(1000000)", result
4848
)
49-
self.assertEquals(return_value, lldb.eReturnStatusFailed)
49+
self.assertEqual(return_value, lldb.eReturnStatusFailed)
5050

5151
# Okay, now do it again with long enough time outs:
5252

@@ -63,7 +63,7 @@ def test(self):
6363
return_value = interp.HandleCommand(
6464
"expr -t 1000000 -u true -- wait_a_while(1000)", result
6565
)
66-
self.assertEquals(return_value, lldb.eReturnStatusSuccessFinishResult)
66+
self.assertEqual(return_value, lldb.eReturnStatusSuccessFinishResult)
6767

6868
# Finally set the one thread timeout and make sure that doesn't change
6969
# things much:

lldb/test/API/commands/expression/unwind_expression/TestUnwindExpression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def test_conditional_bktp(self):
4242
main_frame = self.thread.GetFrameAtIndex(0)
4343
val = main_frame.EvaluateExpression("second_function(47)", options)
4444
self.assertSuccess(val.GetError(), "We did complete the execution.")
45-
self.assertEquals(47, val.GetValueAsSigned())
45+
self.assertEqual(47, val.GetValueAsSigned())
4646

4747
@add_test_categories(["pyapi"])
4848
@expectedFlakeyNetBSD

0 commit comments

Comments
 (0)