diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2024-02-16 20:58:50 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-16 20:58:50 -0800 |
| commit | 80fcecb13c388ff087a27a4b0e7ca3dd8c98eaa4 (patch) | |
| tree | 5dfda69ad17a572f8832ed60746288216d179f9a /lldb/test/API/python_api | |
| parent | 8443ce563bf3500b705ab3507ae586e2a72d31f4 (diff) | |
| download | llvm-80fcecb13c388ff087a27a4b0e7ca3dd8c98eaa4.zip llvm-80fcecb13c388ff087a27a4b0e7ca3dd8c98eaa4.tar.gz llvm-80fcecb13c388ff087a27a4b0e7ca3dd8c98eaa4.tar.bz2 | |
[lldb] Replace assertEquals with assertEqual (NFC) (#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.
Diffstat (limited to 'lldb/test/API/python_api')
10 files changed, 45 insertions, 45 deletions
diff --git a/lldb/test/API/python_api/class_members/TestSBTypeClassMembers.py b/lldb/test/API/python_api/class_members/TestSBTypeClassMembers.py index 3a0483d..5ad2a07 100644 --- a/lldb/test/API/python_api/class_members/TestSBTypeClassMembers.py +++ b/lldb/test/API/python_api/class_members/TestSBTypeClassMembers.py @@ -52,10 +52,10 @@ class SBTypeMemberFunctionsTest(TestBase): Derived = variable.GetType() Base = Derived.GetDirectBaseClassAtIndex(0).GetType() - self.assertEquals( + self.assertEqual( 2, Derived.GetNumberOfMemberFunctions(), "Derived declares two methods" ) - self.assertEquals( + self.assertEqual( "int", Derived.GetMemberFunctionAtIndex(0) .GetType() @@ -64,10 +64,10 @@ class SBTypeMemberFunctionsTest(TestBase): "Derived::dImpl returns int", ) - self.assertEquals( + self.assertEqual( 4, Base.GetNumberOfMemberFunctions(), "Base declares three methods" ) - self.assertEquals( + self.assertEqual( 3, Base.GetMemberFunctionAtIndex(3) .GetType() @@ -75,15 +75,15 @@ class SBTypeMemberFunctionsTest(TestBase): .GetSize(), "Base::sfunc takes three arguments", ) - self.assertEquals( + self.assertEqual( "sfunc", Base.GetMemberFunctionAtIndex(3).GetName(), "Base::sfunc not found" ) - self.assertEquals( + self.assertEqual( lldb.eMemberFunctionKindStaticMethod, Base.GetMemberFunctionAtIndex(3).GetKind(), "Base::sfunc is a static", ) - self.assertEquals( + self.assertEqual( 0, Base.GetMemberFunctionAtIndex(2) .GetType() @@ -91,7 +91,7 @@ class SBTypeMemberFunctionsTest(TestBase): .GetSize(), "Base::dat takes no arguments", ) - self.assertEquals( + self.assertEqual( "char", Base.GetMemberFunctionAtIndex(1) .GetType() @@ -100,69 +100,69 @@ class SBTypeMemberFunctionsTest(TestBase): .GetName(), "Base::bar takes a second 'char' argument", ) - self.assertEquals( + self.assertEqual( "bar", Base.GetMemberFunctionAtIndex(1).GetName(), "Base::bar not found" ) variable = frame0.FindVariable("thingy") Thingy = variable.GetType() - self.assertEquals( + self.assertEqual( 2, Thingy.GetNumberOfMemberFunctions(), "Thingy declares two methods" ) - self.assertEquals( + self.assertEqual( "id", Thingy.GetMemberFunctionAtIndex(0).GetReturnType().GetName(), "Thingy::init returns an id", ) - self.assertEquals( + self.assertEqual( 2, Thingy.GetMemberFunctionAtIndex(1).GetNumberOfArguments(), "Thingy::foo takes two arguments", ) - self.assertEquals( + self.assertEqual( "int", Thingy.GetMemberFunctionAtIndex(1).GetArgumentTypeAtIndex(0).GetName(), "Thingy::foo takes an int", ) - self.assertEquals( + self.assertEqual( "Derived::dImpl()", Derived.GetMemberFunctionAtIndex(0).GetDemangledName() ) - self.assertEquals( + self.assertEqual( "Derived::baz(float)", Derived.GetMemberFunctionAtIndex(1).GetDemangledName(), ) - self.assertEquals( + self.assertEqual( "Base::foo(int, int)", Base.GetMemberFunctionAtIndex(0).GetDemangledName() ) - self.assertEquals( + self.assertEqual( "Base::bar(int, char)", Base.GetMemberFunctionAtIndex(1).GetDemangledName() ) - self.assertEquals( + self.assertEqual( "Base::dat()", Base.GetMemberFunctionAtIndex(2).GetDemangledName() ) - self.assertEquals( + self.assertEqual( "Base::sfunc(char, int, float)", Base.GetMemberFunctionAtIndex(3).GetDemangledName(), ) - self.assertEquals( + self.assertEqual( "_ZN7Derived5dImplEv", Derived.GetMemberFunctionAtIndex(0).GetMangledName() ) - self.assertEquals( + self.assertEqual( "_ZN7Derived3bazEf", Derived.GetMemberFunctionAtIndex(1).GetMangledName() ) - self.assertEquals( + self.assertEqual( "_ZN4Base3fooEii", Base.GetMemberFunctionAtIndex(0).GetMangledName() ) - self.assertEquals( + self.assertEqual( "_ZN4Base3barEic", Base.GetMemberFunctionAtIndex(1).GetMangledName() ) - self.assertEquals( + self.assertEqual( "_ZN4Base3datEv", Base.GetMemberFunctionAtIndex(2).GetMangledName() ) - self.assertEquals( + self.assertEqual( "_ZN4Base5sfuncEcif", Base.GetMemberFunctionAtIndex(3).GetMangledName() ) diff --git a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py index 0f440bd..522de24 100644 --- a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py +++ b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py @@ -32,7 +32,7 @@ class DebuggerAPITestCase(TestBase): self.dbg.SetCurrentPlatformSDKRoot(None) fresh_dbg = lldb.SBDebugger() - self.assertEquals(len(fresh_dbg), 0) + self.assertEqual(len(fresh_dbg), 0) def test_debugger_delete_invalid_target(self): """SBDebugger.DeleteTarget() should not crash LLDB given and invalid target.""" diff --git a/lldb/test/API/python_api/findvalue_duplist/TestSBFrameFindValue.py b/lldb/test/API/python_api/findvalue_duplist/TestSBFrameFindValue.py index df9da03..f989eb5 100644 --- a/lldb/test/API/python_api/findvalue_duplist/TestSBFrameFindValue.py +++ b/lldb/test/API/python_api/findvalue_duplist/TestSBFrameFindValue.py @@ -35,7 +35,7 @@ class SBFrameFindValueTestCase(TestBase): # Frame #0 should be at our breakpoint. threads = lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint) - self.assertEquals(len(threads), 1) + self.assertEqual(len(threads), 1) self.thread = threads[0] self.frame = self.thread.frames[0] self.assertTrue(self.frame, "Frame 0 is valid.") diff --git a/lldb/test/API/python_api/interpreter/TestCommandInterpreterAPI.py b/lldb/test/API/python_api/interpreter/TestCommandInterpreterAPI.py index 586e8da..8f9fbfc 100644 --- a/lldb/test/API/python_api/interpreter/TestCommandInterpreterAPI.py +++ b/lldb/test/API/python_api/interpreter/TestCommandInterpreterAPI.py @@ -82,6 +82,6 @@ class CommandInterpreterAPICase(TestBase): ci.HandleCommand("settings set use-color false", res) self.assertTrue(res.Succeeded()) self.assertIsNotNone(res.GetOutput()) - self.assertEquals(res.GetOutput(), "") + self.assertEqual(res.GetOutput(), "") self.assertIsNotNone(res.GetError()) - self.assertEquals(res.GetError(), "") + self.assertEqual(res.GetError(), "") diff --git a/lldb/test/API/python_api/name_lookup/TestNameLookup.py b/lldb/test/API/python_api/name_lookup/TestNameLookup.py index 2af7226..888c633 100644 --- a/lldb/test/API/python_api/name_lookup/TestNameLookup.py +++ b/lldb/test/API/python_api/name_lookup/TestNameLookup.py @@ -53,7 +53,7 @@ class TestNameLookup(TestBase): self.assertGreaterEqual(len(mangled_to_symbol), 6) for mangled in mangled_to_symbol.keys(): symbol_contexts = target.FindFunctions(mangled, lldb.eFunctionNameTypeFull) - self.assertEquals(symbol_contexts.GetSize(), 1) + self.assertEqual(symbol_contexts.GetSize(), 1) for symbol_context in symbol_contexts: self.assertTrue(symbol_context.GetFunction().IsValid()) self.assertTrue(symbol_context.GetSymbol().IsValid()) diff --git a/lldb/test/API/python_api/objc_type/TestObjCType.py b/lldb/test/API/python_api/objc_type/TestObjCType.py index 5010d8a..3ff2552 100644 --- a/lldb/test/API/python_api/objc_type/TestObjCType.py +++ b/lldb/test/API/python_api/objc_type/TestObjCType.py @@ -52,9 +52,9 @@ class ObjCSBTypeTestCase(TestBase): aFooType = aBarType.GetDirectBaseClassAtIndex(0) self.assertTrue(aFooType.IsValid(), "Foo should be a valid data type") - self.assertEquals(aFooType.GetName(), "Foo", "Foo has the right name") + self.assertEqual(aFooType.GetName(), "Foo", "Foo has the right name") - self.assertEquals(aBarType.GetNumberOfFields(), 1, "Bar has a field") + self.assertEqual(aBarType.GetNumberOfFields(), 1, "Bar has a field") aBarField = aBarType.GetFieldAtIndex(0) self.assertEqual(aBarField.GetName(), "_iVar", "The field has the right name") diff --git a/lldb/test/API/python_api/sblaunchinfo/TestSBLaunchInfo.py b/lldb/test/API/python_api/sblaunchinfo/TestSBLaunchInfo.py index 7703666..6bf144e 100644 --- a/lldb/test/API/python_api/sblaunchinfo/TestSBLaunchInfo.py +++ b/lldb/test/API/python_api/sblaunchinfo/TestSBLaunchInfo.py @@ -21,8 +21,8 @@ class TestSBLaunchInfo(TestBase): def test_environment_getset(self): info = lldb.SBLaunchInfo(None) info.SetEnvironmentEntries(["FOO=BAR"], False) - self.assertEquals(1, info.GetNumEnvironmentEntries()) + self.assertEqual(1, info.GetNumEnvironmentEntries()) info.SetEnvironmentEntries(["BAR=BAZ"], True) - self.assertEquals(2, info.GetNumEnvironmentEntries()) - self.assertEquals("BAR", lookup(info, "FOO")) - self.assertEquals("BAZ", lookup(info, "BAR")) + self.assertEqual(2, info.GetNumEnvironmentEntries()) + self.assertEqual("BAR", lookup(info, "FOO")) + self.assertEqual("BAZ", lookup(info, "BAR")) diff --git a/lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py b/lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py index 38f3d3c..d441a9d 100644 --- a/lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py +++ b/lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py @@ -57,7 +57,7 @@ class SBValuePersistTestCase(TestBase): self.assertEqual(fooPersist.GetValueAsUnsigned(0), 10, "fooPersist != 10") self.assertEqual(barPersist.GetPointeeData().sint32[0], 4, "barPersist != 4") - self.assertEquals(bazPersist.GetSummary(), '"85"', "bazPersist != 85") + self.assertEqual(bazPersist.GetSummary(), '"85"', "bazPersist != 85") self.runCmd("continue") @@ -67,6 +67,6 @@ class SBValuePersistTestCase(TestBase): self.assertEqual(fooPersist.GetValueAsUnsigned(0), 10, "fooPersist != 10") self.assertEqual(barPersist.GetPointeeData().sint32[0], 4, "barPersist != 4") - self.assertEquals(bazPersist.GetSummary(), '"85"', "bazPersist != 85") + self.assertEqual(bazPersist.GetSummary(), '"85"', "bazPersist != 85") self.expect("expr *(%s)" % (barPersist.GetName()), substrs=["= 4"]) diff --git a/lldb/test/API/python_api/type/TestTypeList.py b/lldb/test/API/python_api/type/TestTypeList.py index 63ab958..8d82f7b 100644 --- a/lldb/test/API/python_api/type/TestTypeList.py +++ b/lldb/test/API/python_api/type/TestTypeList.py @@ -209,7 +209,7 @@ class TypeAndTypeListTestCase(TestBase): int_scoped_enum_type = scoped_enum_type.GetEnumerationIntegerType() self.assertTrue(int_scoped_enum_type) self.DebugSBType(int_scoped_enum_type) - self.assertEquals(int_scoped_enum_type.GetName(), "int") + self.assertEqual(int_scoped_enum_type.GetName(), "int") enum_uchar = target.FindFirstType("EnumUChar") self.assertTrue(enum_uchar) @@ -217,4 +217,4 @@ class TypeAndTypeListTestCase(TestBase): int_enum_uchar = enum_uchar.GetEnumerationIntegerType() self.assertTrue(int_enum_uchar) self.DebugSBType(int_enum_uchar) - self.assertEquals(int_enum_uchar.GetName(), "unsigned char") + self.assertEqual(int_enum_uchar.GetName(), "unsigned char") diff --git a/lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py b/lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py index 215feb3..07250eb 100644 --- a/lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py +++ b/lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py @@ -66,7 +66,7 @@ class ChangeValueAPITestCase(TestBase): self.assertTrue(val_value.IsValid(), "Got the SBValue for val") actual_value = val_value.GetValueAsSigned(error, 0) self.assertSuccess(error, "Got a value from val") - self.assertEquals(actual_value, 100, "Got the right value from val") + self.assertEqual(actual_value, 100, "Got the right value from val") result = val_value.SetValueFromCString("12345") self.assertTrue(result, "Setting val returned True.") @@ -83,13 +83,13 @@ class ChangeValueAPITestCase(TestBase): self.assertTrue(mine_second_value.IsValid(), "Got second_val from mine") actual_value = mine_second_value.GetValueAsUnsigned(error, 0) self.assertTrue(error.Success(), "Got an unsigned value for second_val") - self.assertEquals(actual_value, 5555) + self.assertEqual(actual_value, 5555) result = mine_second_value.SetValueFromCString("98765") self.assertTrue(result, "Success setting mine.second_value.") actual_value = mine_second_value.GetValueAsSigned(error, 0) self.assertTrue(error.Success(), "Got a changed value from mine.second_val") - self.assertEquals( + self.assertEqual( actual_value, 98765, "Got the right changed value from mine.second_val" ) @@ -101,13 +101,13 @@ class ChangeValueAPITestCase(TestBase): self.assertTrue(ptr_second_value.IsValid(), "Got second_val from ptr") actual_value = ptr_second_value.GetValueAsUnsigned(error, 0) self.assertTrue(error.Success(), "Got an unsigned value for ptr->second_val") - self.assertEquals(actual_value, 6666) + self.assertEqual(actual_value, 6666) result = ptr_second_value.SetValueFromCString("98765") self.assertTrue(result, "Success setting ptr->second_value.") actual_value = ptr_second_value.GetValueAsSigned(error, 0) self.assertTrue(error.Success(), "Got a changed value from ptr->second_val") - self.assertEquals( + self.assertEqual( actual_value, 98765, "Got the right changed value from ptr->second_val" ) |
