Skip to content

Commit 7c6f381

Browse files
committed
[lldb] Replace assertEquals with assertEqual (NFC)
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. This is the equivalent of 80fcecb upstream but for the Swift tests.
1 parent 2638d28 commit 7c6f381

File tree

6 files changed

+12
-14
lines changed

6 files changed

+12
-14
lines changed

lldb/test/API/functionalities/swift-runtime-reporting/exclusivity-violation/TestExclusivityViolation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def do_test(self):
5858
frame = thread.GetSelectedFrame()
5959

6060
frame_variables = frame.GetVariables(True, False, False, False)
61-
self.assertEquals(frame_variables.GetSize(), 1)
62-
self.assertEquals(frame_variables.GetValueAtIndex(0).GetName(), "p")
61+
self.assertEqual(frame_variables.GetSize(), 1)
62+
self.assertEqual(frame_variables.GetValueAtIndex(0).GetName(), "p")
6363

6464
addr = frame_variables.GetValueAtIndex(0).GetValueAsUnsigned()
6565

lldb/test/API/lang/swift/imported_types/cgtypes/TestCGImportedTypes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ def test_swift_cg_imported_types(self):
3939
self.assertTrue(
4040
x_native.IsValid(),
4141
"Got valid native from cgrect.origin.x")
42-
self.assertEquals(x_native.GetValue(), "10", "Value of x is correct")
42+
self.assertEqual(x_native.GetValue(), "10", "Value of x is correct")

lldb/test/API/lang/swift/split_debug/TestSwiftSplitDebug.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def check_val(self, var_name, expected_val):
3939

4040
self.assertTrue(value.IsValid(),
4141
"expr " + var_name + " returned a valid value")
42-
self.assertEquals(value.GetValue(), expected_val)
42+
self.assertEqual(value.GetValue(), expected_val)
4343

4444
def do_test(self):
4545
"""Test the split debug info"""

lldb/test/API/lang/swift/swift-healthcheck/TestSwiftHealthCheck.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_run_healthcheck(self):
2222
result = lldb.SBCommandReturnObject()
2323
ret_val = self.dbg.GetCommandInterpreter().HandleCommand("swift-healthcheck", result)
2424
log = result.GetOutput()[:-1].split(" ")[-1]
25-
self.assertEquals(log[-4:], ".log")
25+
self.assertEqual(log[-4:], ".log")
2626
import io, re
2727
logfile = io.open(log, "r", encoding='utf-8')
2828
good = 0
@@ -35,7 +35,7 @@ def test_run_healthcheck(self):
3535
bad += 1
3636
break
3737
self.assertGreater(good, 1)
38-
self.assertEquals(bad, 0)
38+
self.assertEqual(bad, 0)
3939

4040
@swiftTest
4141
@skipIfDarwinEmbedded

lldb/test/API/lang/swift/tripleDetection/TestSwiftTripleDetection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ def test(self):
4040
if found == 1 and re.search('SwiftASTContextForExpressions.*setting to ".*-apple-macos.[0-9.]+"', line):
4141
found += 1
4242
break
43-
self.assertEquals(found, 2)
43+
self.assertEqual(found, 2)

lldb/test/API/lang/swift/variables/inout/TestInOutVariables.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# TestInOutVariables.py
2-
#
3-
# This source file is part of the Swift.org open source project
1+
# TestInOutVariables.py This source file is part of the Swift.org open source project
42
#
53
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
64
# Licensed under Apache License v2.0 with Runtime Library Exception
@@ -69,18 +67,18 @@ def check_class_internal(
6967

7068
ivar = x_actual.GetChildAtIndex(0).GetChildAtIndex(0)
7169
ovar = x_actual.GetChildAtIndex(1)
72-
self.assertEquals(
70+
self.assertEqual(
7371
ivar.GetName(), "ivar", "Name: %s is not ivar %s" %
7472
(ivar.GetName(), message_end))
75-
self.assertEquals(
73+
self.assertEqual(
7674
ovar.GetName(), "ovar",
7775
"ovar is not ovar %s" %
7876
(message_end))
79-
self.assertEquals(
77+
self.assertEqual(
8078
ivar.GetValue(), ivar_value,
8179
"ivar wrong %s" %
8280
(message_end))
83-
self.assertEquals(
81+
self.assertEqual(
8482
ovar.GetValue(), ovar_value,
8583
"ovar wrong %s" %
8684
(message_end))

0 commit comments

Comments
 (0)