[Lldb-commits] [lldb] 1fb5c7a - [lldb] Rewrite to assertEqual/assertNotEqual (NFC)

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 11 17:03:12 PST 2022


Author: Dave Lee
Date: 2022-11-11T17:03:02-08:00
New Revision: 1fb5c7a2f17f10e768160fe23d4a04537c7224c1

URL: https://github.com/llvm/llvm-project/commit/1fb5c7a2f17f10e768160fe23d4a04537c7224c1
DIFF: https://github.com/llvm/llvm-project/commit/1fb5c7a2f17f10e768160fe23d4a04537c7224c1.diff

LOG: [lldb] Rewrite to assertEqual/assertNotEqual (NFC)

Using the more specific assert* methods results in more useful error message.

Added: 
    

Modified: 
    lldb/test/API/api/listeners/TestListener.py
    lldb/test/API/commands/expression/call-restarts/TestCallThatRestarts.py
    lldb/test/API/commands/expression/formatters/TestFormatters.py
    lldb/test/API/commands/trace/TestTraceExport.py
    lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
    lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
    lldb/test/API/functionalities/dwo/TestZeroDwoId.py
    lldb/test/API/functionalities/fat_archives/TestFatArchives.py
    lldb/test/API/functionalities/recursion/TestValueObjectRecursion.py
    lldb/test/API/functionalities/step-avoids-no-debug/TestStepNoDebug.py
    lldb/test/API/lang/c/fpeval/TestFPEval.py
    lldb/test/API/lang/c/stepping/TestStepAndBreakpoints.py
    lldb/test/API/lang/cpp/dynamic-value/TestCppValueCast.py
    lldb/test/API/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py
    lldb/test/API/lang/objc/objc-property/TestObjCProperty.py
    lldb/test/API/lang/objc/objc-stepping/TestObjCStepping.py
    lldb/test/API/macosx/corefile-exception-reason/TestCorefileExceptionReason.py
    lldb/test/API/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py
    lldb/test/API/macosx/find-dsym/deep-bundle/TestDeepBundle.py
    lldb/test/API/macosx/queues/TestQueues.py
    lldb/test/API/python_api/absolute_symbol/TestAbsoluteSymbol.py
    lldb/test/API/python_api/findvalue_duplist/TestSBFrameFindValue.py
    lldb/test/API/python_api/function_symbol/TestSymbolAPI.py
    lldb/test/API/python_api/module_section/TestModuleAndSection.py
    lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py
    lldb/test/API/python_api/sbdata/TestSBData.py
    lldb/test/API/python_api/value/TestValueAPI.py
    lldb/test/API/python_api/value_var_update/TestValueVarUpdate.py
    lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/api/listeners/TestListener.py b/lldb/test/API/api/listeners/TestListener.py
index de0491b6dbc15..c6f15bf4f92cb 100644
--- a/lldb/test/API/api/listeners/TestListener.py
+++ b/lldb/test/API/api/listeners/TestListener.py
@@ -63,8 +63,8 @@ def test_receiving_breakpoint_added_from_debugger(self):
         self.assertTrue(
             lldb.SBBreakpoint.EventIsBreakpointEvent(event),
             "It is a breakpoint event.")
-        self.assertTrue(lldb.SBBreakpoint.GetBreakpointEventTypeFromEvent(
-            event) == lldb.eBreakpointEventTypeAdded, "It is a breakpoint added event.")
+        self.assertEqual(lldb.SBBreakpoint.GetBreakpointEventTypeFromEvent(event),
+            lldb.eBreakpointEventTypeAdded, "It is a breakpoint added event.")
         self.assertEqual(
             bkpt, lldb.SBBreakpoint.GetBreakpointFromEvent(event),
             "It is our breakpoint.")
@@ -106,8 +106,8 @@ def test_recieving_breakpoint_added_from_target(self):
         self.assertTrue(
             lldb.SBBreakpoint.EventIsBreakpointEvent(event),
             "It is a breakpoint event.")
-        self.assertTrue(lldb.SBBreakpoint.GetBreakpointEventTypeFromEvent(
-            event) == lldb.eBreakpointEventTypeAdded, "It is a breakpoint added event.")
+        self.assertEqual(lldb.SBBreakpoint.GetBreakpointEventTypeFromEvent(event),
+            lldb.eBreakpointEventTypeAdded, "It is a breakpoint added event.")
         self.assertEqual(
             bkpt, lldb.SBBreakpoint.GetBreakpointFromEvent(event),
             "It is our breakpoint.")

diff  --git a/lldb/test/API/commands/expression/call-restarts/TestCallThatRestarts.py b/lldb/test/API/commands/expression/call-restarts/TestCallThatRestarts.py
index 487c55f2bb3bb..995a5955b0762 100644
--- a/lldb/test/API/commands/expression/call-restarts/TestCallThatRestarts.py
+++ b/lldb/test/API/commands/expression/call-restarts/TestCallThatRestarts.py
@@ -31,9 +31,8 @@ def test(self):
 
     def check_after_call(self, num_sigchld):
         after_call = self.sigchld_no.GetValueAsSigned(-1)
-        self.assertTrue(
-            after_call -
-            self.start_sigchld_no == num_sigchld,
+        self.assertEqual(
+            after_call - self.start_sigchld_no, num_sigchld,
             "Really got %d SIGCHLD signals through the call." %
             (num_sigchld))
         self.start_sigchld_no = after_call
@@ -58,8 +57,8 @@ def call_function(self):
             "Got a value for sigchld_no")
 
         self.start_sigchld_no = self.sigchld_no.GetValueAsSigned(-1)
-        self.assertTrue(
-            self.start_sigchld_no != -1,
+        self.assertNotEqual(
+            self.start_sigchld_no, -1,
             "Got an actual value for sigchld_no")
 
         options = lldb.SBExpressionOptions()

diff  --git a/lldb/test/API/commands/expression/formatters/TestFormatters.py b/lldb/test/API/commands/expression/formatters/TestFormatters.py
index f6eeeb2abe96c..4073ac3f56f57 100644
--- a/lldb/test/API/commands/expression/formatters/TestFormatters.py
+++ b/lldb/test/API/commands/expression/formatters/TestFormatters.py
@@ -216,10 +216,8 @@ def cleanup():
         a_data = frozen.GetPointeeData()
 
         error = lldb.SBError()
-        self.assertTrue(
-            a_data.GetUnsignedInt32(
-                error,
-                0) == 122,
+        self.assertEqual(
+            a_data.GetUnsignedInt32(error, 0), 122,
             '*a_ptr = 122')
 
         ret = line_number("main.cpp", "Done initializing")
@@ -235,58 +233,38 @@ def cleanup():
 
         a_data = frozen.GetPointeeData(0, 1)
 
-        self.assertTrue(
-            a_data.GetUnsignedInt32(
-                error,
-                0) == 1,
+        self.assertEqual(
+            a_data.GetUnsignedInt32(error, 0), 1,
             'numbers[0] == 1')
-        self.assertTrue(
-            a_data.GetUnsignedInt32(
-                error,
-                4) == 2,
+        self.assertEqual(
+            a_data.GetUnsignedInt32(error, 4), 2,
             'numbers[1] == 2')
-        self.assertTrue(
-            a_data.GetUnsignedInt32(
-                error,
-                8) == 3,
+        self.assertEqual(
+            a_data.GetUnsignedInt32(error, 8), 3,
             'numbers[2] == 3')
-        self.assertTrue(
-            a_data.GetUnsignedInt32(
-                error,
-                12) == 4,
+        self.assertEqual(
+            a_data.GetUnsignedInt32(error, 12), 4,
             'numbers[3] == 4')
-        self.assertTrue(
-            a_data.GetUnsignedInt32(
-                error,
-                16) == 5,
+        self.assertEqual(
+            a_data.GetUnsignedInt32(error, 16), 5,
             'numbers[4] == 5')
 
         frozen = frame.EvaluateExpression("numbers")
 
         a_data = frozen.GetData()
 
-        self.assertTrue(
-            a_data.GetUnsignedInt32(
-                error,
-                0) == 1,
+        self.assertEqual(
+            a_data.GetUnsignedInt32(error, 0), 1,
             'numbers[0] == 1')
-        self.assertTrue(
-            a_data.GetUnsignedInt32(
-                error,
-                4) == 2,
+        self.assertEqual(
+            a_data.GetUnsignedInt32(error, 4), 2,
             'numbers[1] == 2')
-        self.assertTrue(
-            a_data.GetUnsignedInt32(
-                error,
-                8) == 3,
+        self.assertEqual(
+            a_data.GetUnsignedInt32(error, 8), 3,
             'numbers[2] == 3')
-        self.assertTrue(
-            a_data.GetUnsignedInt32(
-                error,
-                12) == 4,
+        self.assertEqual(
+            a_data.GetUnsignedInt32(error, 12), 4,
             'numbers[3] == 4')
-        self.assertTrue(
-            a_data.GetUnsignedInt32(
-                error,
-                16) == 5,
+        self.assertEqual(
+            a_data.GetUnsignedInt32(error, 16), 5,
             'numbers[4] == 5')

diff  --git a/lldb/test/API/commands/trace/TestTraceExport.py b/lldb/test/API/commands/trace/TestTraceExport.py
index 981df96932fba..2a5f1863af738 100644
--- a/lldb/test/API/commands/trace/TestTraceExport.py
+++ b/lldb/test/API/commands/trace/TestTraceExport.py
@@ -111,10 +111,10 @@ def _testHtrBasicSuperBlockPassFullCheck(self):
         ]
 
         # Check that the length of the expected JSON array is equal to the actual
-        self.assertTrue(len(data) == len(expected))
+        self.assertEqual(len(data), len(expected))
         for i in range(len(data)):
             # Check each individual JSON object in "ctf-test.json" against the expected value above
-            self.assertTrue(data[i] == expected[i])
+            self.assertEqual(data[i], expected[i])
 
     def _testHtrBasicSuperBlockPassSequenceCheck(self):
         '''
@@ -169,4 +169,4 @@ def _testHtrBasicSuperBlockPassSequenceCheck(self):
 
         data_index = index_of_first_layer_1_block
         for i in range(len(expected_block_names)):
-            self.assertTrue(data[data_index + i]['name'] == expected_block_names[i])
+            self.assertEqual(data[data_index + i]['name'], expected_block_names[i])

diff  --git a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py b/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
index 6c0afee57abbf..36860ecb29482 100644
--- a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
+++ b/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
@@ -102,7 +102,7 @@ def test_breakpoints_with_relative_path_line_tables(self):
         self.runCmd("settings clear target.source-map")
         for path in invalid_paths:
             bkpt = target.BreakpointCreateByLocation(path, 2)
-            self.assertTrue(bkpt.GetNumLocations() == 0,
+            self.assertEqual(bkpt.GetNumLocations(), 0,
                 'Incorrectly resolved a breakpoint using full path "%s" with '
                 'debug info that has relative path with matching suffix' % (path))
 

diff  --git a/lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py b/lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
index 8b09cbc31118d..a8eeb6f291aa5 100644
--- a/lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
+++ b/lldb/test/API/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
@@ -147,7 +147,7 @@ def check_equivalence(self, source_bps, do_write = True):
 
             # These two should be identical.
             self.trace("Source text for %d is %s."%(i, source_text))
-            self.assertTrue (source_text == copy_text, "Source and dest breakpoints are not identical: \nsource: %s\ndest: %s"%(source_text, copy_text))
+            self.assertEqual(source_text, copy_text, "Source and dest breakpoints are not identical: \nsource: %s\ndest: %s"%(source_text, copy_text))
 
     def do_check_resolvers(self):
         """Use Python APIs to check serialization of breakpoint resolvers"""

diff  --git a/lldb/test/API/functionalities/dwo/TestZeroDwoId.py b/lldb/test/API/functionalities/dwo/TestZeroDwoId.py
index 40d8583097f7e..7fc00c6fd58d2 100644
--- a/lldb/test/API/functionalities/dwo/TestZeroDwoId.py
+++ b/lldb/test/API/functionalities/dwo/TestZeroDwoId.py
@@ -39,7 +39,7 @@ def test_zero_dwo_id (self):
         # Set a breakpoint by file and line, this doesn't require anything from
         # the .dwo file.
         bp = target.BreakpointCreateByLocation('main.cpp', 6)
-        self.assertTrue(bp.GetNumLocations() == 1)
+        self.assertEqual(bp.GetNumLocations(), 1)
         bp_loc = bp.GetLocationAtIndex(0)
         self.assertTrue(bp_loc.IsValid())
 

diff  --git a/lldb/test/API/functionalities/fat_archives/TestFatArchives.py b/lldb/test/API/functionalities/fat_archives/TestFatArchives.py
index 11b3edd44da65..21614f942fc51 100644
--- a/lldb/test/API/functionalities/fat_archives/TestFatArchives.py
+++ b/lldb/test/API/functionalities/fat_archives/TestFatArchives.py
@@ -50,6 +50,6 @@ def main(self):
             self.assertTrue(
                 line_entry.GetFileSpec(),
                 "Verify breakpoint in fat BSD archive has source file information")
-            self.assertTrue(
-                line_entry.GetLine() != 0,
+            self.assertNotEqual(
+                line_entry.GetLine(), 0,
                 "Verify breakpoint in fat BSD archive has source line information")

diff  --git a/lldb/test/API/functionalities/recursion/TestValueObjectRecursion.py b/lldb/test/API/functionalities/recursion/TestValueObjectRecursion.py
index 4d83bf322ccc7..7e8c7cb8952fe 100644
--- a/lldb/test/API/functionalities/recursion/TestValueObjectRecursion.py
+++ b/lldb/test/API/functionalities/recursion/TestValueObjectRecursion.py
@@ -56,9 +56,9 @@ def cleanup():
         self.assertTrue(
             child.GetChildAtIndex(0).IsValid(),
             "the deep ValueObject has no value")
-        self.assertTrue(
-            child.GetChildAtIndex(0).GetValueAsUnsigned() != 0,
+        self.assertNotEqual(
+            child.GetChildAtIndex(0).GetValueAsUnsigned(), 0,
             "the deep ValueObject has a zero value")
-        self.assertTrue(
-            child.GetChildAtIndex(1).GetValueAsUnsigned() != 0,
+        self.assertNotEqual(
+            child.GetChildAtIndex(1).GetValueAsUnsigned(), 0,
             "the deep ValueObject has no next")

diff  --git a/lldb/test/API/functionalities/step-avoids-no-debug/TestStepNoDebug.py b/lldb/test/API/functionalities/step-avoids-no-debug/TestStepNoDebug.py
index 98b80051368a9..17ac2e067e299 100644
--- a/lldb/test/API/functionalities/step-avoids-no-debug/TestStepNoDebug.py
+++ b/lldb/test/API/functionalities/step-avoids-no-debug/TestStepNoDebug.py
@@ -71,8 +71,8 @@ def tearDown(self):
 
     def hit_correct_line(self, pattern):
         target_line = line_number(self.main_source, pattern)
-        self.assertTrue(
-            target_line != 0,
+        self.assertNotEqual(
+            target_line, 0,
             "Could not find source pattern " +
             pattern)
         cur_line = self.thread.frames[0].GetLineEntry().GetLine()

diff  --git a/lldb/test/API/lang/c/fpeval/TestFPEval.py b/lldb/test/API/lang/c/fpeval/TestFPEval.py
index 42ea02cc00123..f2b6bf7092d43 100644
--- a/lldb/test/API/lang/c/fpeval/TestFPEval.py
+++ b/lldb/test/API/lang/c/fpeval/TestFPEval.py
@@ -95,5 +95,5 @@ def test(self):
                 v1 = frame.EvaluateExpression("{0}; eval(x, y, 2)".format(vardef), self.jit_opts)
                 v2 = frame.EvaluateExpression("{0}; x / y".format(vardef), self.no_jit_opts)
                 self.assertTrue(v1.IsValid() and v2.IsValid())
-                self.assertTrue(str(v1.GetData()) == str(v2.GetData()))
+                self.assertEqual(str(v1.GetData()), str(v2.GetData()))
 

diff  --git a/lldb/test/API/lang/c/stepping/TestStepAndBreakpoints.py b/lldb/test/API/lang/c/stepping/TestStepAndBreakpoints.py
index 18347716e30dd..b7ba7332fc7c2 100644
--- a/lldb/test/API/lang/c/stepping/TestStepAndBreakpoints.py
+++ b/lldb/test/API/lang/c/stepping/TestStepAndBreakpoints.py
@@ -209,10 +209,10 @@ def test_and_python_api(self):
         # should end up back in "a" as if nothing had happened:
         process.Continue()
 
-        self.assertTrue(thread.GetFrameAtIndex(
-            0).GetLineEntry().GetLine() == current_line)
-        self.assertTrue(thread.GetFrameAtIndex(
-            0).GetLineEntry().GetFileSpec() == current_file)
+        self.assertEqual(
+            thread.GetFrameAtIndex(0).GetLineEntry().GetLine(), current_line)
+        self.assertEqual(
+            thread.GetFrameAtIndex(0).GetLineEntry().GetFileSpec(), current_file)
 
         # Now we are going to test step in targeting a function:
 
@@ -252,8 +252,7 @@ def test_and_python_api(self):
         break_before_complex_2.SetEnabled(False)
 
         thread.StepInto("complex")
-        self.assertTrue(thread.GetFrameAtIndex(
-            0).GetFunctionName() == "complex")
+        self.assertEqual(thread.GetFrameAtIndex(0).GetFunctionName(), "complex")
 
         # Now continue out and stop at the next call to complex.  This time
         # enable breakpoints in a and c and then step targeting b:

diff  --git a/lldb/test/API/lang/cpp/dynamic-value/TestCppValueCast.py b/lldb/test/API/lang/cpp/dynamic-value/TestCppValueCast.py
index 5b298b442196a..f1d4e1273eca0 100644
--- a/lldb/test/API/lang/cpp/dynamic-value/TestCppValueCast.py
+++ b/lldb/test/API/lang/cpp/dynamic-value/TestCppValueCast.py
@@ -78,8 +78,8 @@ def do_sbvalue_cast(self, exe_name):
 
         tellerA = frame0.FindVariable('teller', lldb.eNoDynamicValues)
         self.DebugSBValue(tellerA)
-        self.assertTrue(tellerA.GetChildMemberWithName(
-            'm_base_val').GetValueAsUnsigned(error, 0) == 20)
+        self.assertEqual(
+            tellerA.GetChildMemberWithName('m_base_val').GetValueAsUnsigned(error, 0), 20)
 
         if self.TraceOn():
             for child in tellerA:
@@ -107,8 +107,8 @@ def do_sbvalue_cast(self, exe_name):
 
         tellerB = frame0.FindVariable('teller', lldb.eNoDynamicValues)
         self.DebugSBValue(tellerB)
-        self.assertTrue(tellerB.GetChildMemberWithName(
-            'm_base_val').GetValueAsUnsigned(error, 0) == 12)
+        self.assertEqual(
+            tellerB.GetChildMemberWithName('m_base_val').GetValueAsUnsigned(error, 0), 12)
 
         if self.TraceOn():
             for child in tellerB:

diff  --git a/lldb/test/API/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py b/lldb/test/API/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py
index 363b2316155bc..0343ee2cb10cb 100644
--- a/lldb/test/API/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py
+++ b/lldb/test/API/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py
@@ -74,10 +74,12 @@ def test_dyn(self):
             base_pointee_type.GetDirectBaseClassAtIndex(0).GetName(), "MyBaseClass",
             "The dynamic type for Base can go back to its base class")
 
-        self.assertTrue(object_pointee_type.GetDirectBaseClassAtIndex(0).GetType().GetDirectBaseClassAtIndex(
-            0).GetName() == "NSObject", "The dynamic type for NSObject can go up the hierarchy")
-        self.assertTrue(base_pointee_type.GetDirectBaseClassAtIndex(0).GetType().GetDirectBaseClassAtIndex(
-            0).GetName() == "NSObject", "The dynamic type for Base can go up the hierarchy")
+        self.assertEqual(
+            object_pointee_type.GetDirectBaseClassAtIndex(0).GetType().GetDirectBaseClassAtIndex(0).GetName(),
+            "NSObject", "The dynamic type for NSObject can go up the hierarchy")
+        self.assertEqual(
+            base_pointee_type.GetDirectBaseClassAtIndex(0).GetType().GetDirectBaseClassAtIndex(0).GetName(),
+            "NSObject", "The dynamic type for Base can go up the hierarchy")
 
         self.assertEqual(
             object_pointee_type.GetNumberOfFields(), 2,

diff  --git a/lldb/test/API/lang/objc/objc-property/TestObjCProperty.py b/lldb/test/API/lang/objc/objc-property/TestObjCProperty.py
index 1582d3f518642..2316d91cda0c6 100644
--- a/lldb/test/API/lang/objc/objc-property/TestObjCProperty.py
+++ b/lldb/test/API/lang/objc/objc-property/TestObjCProperty.py
@@ -104,8 +104,8 @@ def test_objc_properties(self):
         self.assertSuccess(backed_error)
         backing_value = mine.GetChildMemberWithName("_backedInt")
         self.assertTrue(backing_value.IsValid())
-        self.assertTrue(backed_value.GetValueAsUnsigned(12345)
-                        == backing_value.GetValueAsUnsigned(23456))
+        self.assertEqual(backed_value.GetValueAsUnsigned(12345),
+                        backing_value.GetValueAsUnsigned(23456))
 
         value_from_typedef = frame.EvaluateExpression("typedefd.backedInt", False)
         self.assertSuccess(value_from_typedef.GetError())

diff  --git a/lldb/test/API/lang/objc/objc-stepping/TestObjCStepping.py b/lldb/test/API/lang/objc/objc-stepping/TestObjCStepping.py
index 5b4fffd6ccf0a..1bbabdfa2c7ce 100644
--- a/lldb/test/API/lang/objc/objc-stepping/TestObjCStepping.py
+++ b/lldb/test/API/lang/objc/objc-stepping/TestObjCStepping.py
@@ -154,8 +154,8 @@ def test_with_python_api(self):
             print("className is %s, newClassName is %s" % (className, newClassName))
             print(mySource_isa)
 
-        self.assertTrue(
-            newClassName != className,
+        self.assertNotEqual(
+            newClassName, className,
             "The isa did indeed change, swizzled!")
 
         # Now step in, that should leave us in the Source randomMethod:

diff  --git a/lldb/test/API/macosx/corefile-exception-reason/TestCorefileExceptionReason.py b/lldb/test/API/macosx/corefile-exception-reason/TestCorefileExceptionReason.py
index cd87816549af1..dc43338312a9d 100644
--- a/lldb/test/API/macosx/corefile-exception-reason/TestCorefileExceptionReason.py
+++ b/lldb/test/API/macosx/corefile-exception-reason/TestCorefileExceptionReason.py
@@ -39,4 +39,4 @@ def test(self):
             self.runCmd("bt")
             self.runCmd("fr v")
 
-        self.assertTrue(thread.GetStopDescription(256) == "ESR_EC_DABORT_EL0 (fault address: 0x0)")
+        self.assertEqual(thread.GetStopDescription(256), "ESR_EC_DABORT_EL0 (fault address: 0x0)")

diff  --git a/lldb/test/API/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py b/lldb/test/API/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py
index 1be8da905affe..71c67fe1530e0 100644
--- a/lldb/test/API/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py
+++ b/lldb/test/API/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py
@@ -67,6 +67,6 @@ def test_attach_and_check_dsyms(self):
             mod = target.GetModuleAtIndex(i)
             if mod.GetFileSpec().GetFilename() == 'com.apple.sbd':
                 dsym_name = mod.GetSymbolFileSpec().GetFilename()
-                self.assertTrue (dsym_name == 'com.apple.sbd', "Check that we found the dSYM for the bundle that was loaded")
+                self.assertEqual(dsym_name, 'com.apple.sbd', "Check that we found the dSYM for the bundle that was loaded")
             i=i+1
         os.chdir(self.getSourceDir());

diff  --git a/lldb/test/API/macosx/find-dsym/deep-bundle/TestDeepBundle.py b/lldb/test/API/macosx/find-dsym/deep-bundle/TestDeepBundle.py
index 6867ae0b2ff42..765986289c9c5 100644
--- a/lldb/test/API/macosx/find-dsym/deep-bundle/TestDeepBundle.py
+++ b/lldb/test/API/macosx/find-dsym/deep-bundle/TestDeepBundle.py
@@ -66,7 +66,7 @@ def test_attach_and_check_dsyms(self):
             if mod.GetFileSpec().GetFilename() == 'MyFramework':
                 found_module = True
                 dsym_name = mod.GetSymbolFileSpec().GetFilename()
-                self.assertTrue (dsym_name == 'MyFramework', "Check that we found the dSYM for the bundle that was loaded")
+                self.assertEqual(dsym_name, 'MyFramework', "Check that we found the dSYM for the bundle that was loaded")
             i=i+1
 
         self.assertTrue(found_module, "Check that we found the framework loaded in lldb's image list")

diff  --git a/lldb/test/API/macosx/queues/TestQueues.py b/lldb/test/API/macosx/queues/TestQueues.py
index f906f5b314279..21efac2c5d166 100644
--- a/lldb/test/API/macosx/queues/TestQueues.py
+++ b/lldb/test/API/macosx/queues/TestQueues.py
@@ -377,15 +377,17 @@ def queues_with_libBacktraceRecording(self):
 
         self.assertTrue(queue_performer_2.GetPendingItemAtIndex(
             0).IsValid(), "queue 2's pending item #0 is valid")
-        self.assertTrue(queue_performer_2.GetPendingItemAtIndex(0).GetAddress().GetSymbol(
-        ).GetName() == "doing_the_work_2", "queue 2's pending item #0 should be doing_the_work_2")
+        self.assertEqual(
+            queue_performer_2.GetPendingItemAtIndex(0).GetAddress().GetSymbol().GetName(),
+            "doing_the_work_2", "queue 2's pending item #0 should be doing_the_work_2")
         self.assertEqual(
             queue_performer_2.GetNumPendingItems(), 9999,
             "verify that queue 2 still has 9999 pending items")
         self.assertTrue(queue_performer_2.GetPendingItemAtIndex(
             9998).IsValid(), "queue 2's pending item #9998 is valid")
-        self.assertTrue(queue_performer_2.GetPendingItemAtIndex(9998).GetAddress().GetSymbol(
-        ).GetName() == "doing_the_work_2", "queue 2's pending item #0 should be doing_the_work_2")
+        self.assertEqual(
+            queue_performer_2.GetPendingItemAtIndex(9998).GetAddress().GetSymbol().GetName(),
+            "doing_the_work_2", "queue 2's pending item #0 should be doing_the_work_2")
         self.assertTrue(queue_performer_2.GetPendingItemAtIndex(
             9999).IsValid() == False, "queue 2's pending item #9999 is invalid")
 

diff  --git a/lldb/test/API/python_api/absolute_symbol/TestAbsoluteSymbol.py b/lldb/test/API/python_api/absolute_symbol/TestAbsoluteSymbol.py
index f51bd2d3a0374..6e419f6f77c82 100644
--- a/lldb/test/API/python_api/absolute_symbol/TestAbsoluteSymbol.py
+++ b/lldb/test/API/python_api/absolute_symbol/TestAbsoluteSymbol.py
@@ -77,4 +77,4 @@ def test_absolute_symbol(self):
         # prefix of ".absolute." followed by the symbol name as they interfere
         # with address lookups if they are treated like real sections.
         for section in module.sections:
-            self.assertTrue(section.GetName() != ".absolute.absolute")
+            self.assertNotEqual(section.GetName(), ".absolute.absolute")

diff  --git a/lldb/test/API/python_api/findvalue_duplist/TestSBFrameFindValue.py b/lldb/test/API/python_api/findvalue_duplist/TestSBFrameFindValue.py
index 7dc0781446d04..42961f8c988f5 100644
--- a/lldb/test/API/python_api/findvalue_duplist/TestSBFrameFindValue.py
+++ b/lldb/test/API/python_api/findvalue_duplist/TestSBFrameFindValue.py
@@ -42,12 +42,8 @@ def test_formatters_api(self):
         self.frame = self.thread.frames[0]
         self.assertTrue(self.frame, "Frame 0 is valid.")
 
-        self.assertTrue(
-            self.frame.GetVariables(
-                True,
-                True,
-                False,
-                True).GetSize() == 2,
+        self.assertEqual(
+            self.frame.GetVariables(True, True, False, True).GetSize(), 2,
             "variable count is off")
         self.assertFalse(
             self.frame.FindValue(
@@ -55,12 +51,8 @@ def test_formatters_api(self):
                 lldb.eValueTypeVariableArgument,
                 lldb.eDynamicCanRunTarget).IsValid(),
             "found something that should not be here")
-        self.assertTrue(
-            self.frame.GetVariables(
-                True,
-                True,
-                False,
-                True).GetSize() == 2,
+        self.assertEqual(
+            self.frame.GetVariables(True, True, False, True).GetSize(), 2,
             "variable count is off after failed FindValue()")
         self.assertTrue(
             self.frame.FindValue(
@@ -68,10 +60,6 @@ def test_formatters_api(self):
                 lldb.eValueTypeVariableArgument,
                 lldb.eDynamicCanRunTarget).IsValid(),
             "FindValue() didn't find an argument")
-        self.assertTrue(
-            self.frame.GetVariables(
-                True,
-                True,
-                False,
-                True).GetSize() == 2,
+        self.assertEqual(
+            self.frame.GetVariables(True, True, False, True).GetSize(), 2,
             "variable count is off after successful FindValue()")

diff  --git a/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py b/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py
index 5e6a02a33e3ef..14cc3ebe870f4 100644
--- a/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py
+++ b/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py
@@ -59,8 +59,8 @@ def test(self):
         self.assertEqual(symbol_line1.GetType(), lldb.eSymbolTypeCode)
         addr_line1 = symbol_line1.GetStartAddress()
         # And a section type of code, too.
-        self.assertTrue(addr_line1.GetSection().GetSectionType()
-                        == lldb.eSectionTypeCode)
+        self.assertEqual(addr_line1.GetSection().GetSectionType(),
+                         lldb.eSectionTypeCode)
 
         # Continue the inferior, the breakpoint 2 should be hit.
         process.Continue()
@@ -76,11 +76,11 @@ def test(self):
         self.assertEqual(symbol_line2.GetType(), lldb.eSymbolTypeCode)
         addr_line2 = symbol_line2.GetStartAddress()
         # And a section type of code, too.
-        self.assertTrue(addr_line2.GetSection().GetSectionType()
-                        == lldb.eSectionTypeCode)
+        self.assertEqual(addr_line2.GetSection().GetSectionType(),
+                         lldb.eSectionTypeCode)
 
         # Now verify that both addresses point to the same module.
         if self.TraceOn():
             print("UUID:", addr_line1.GetModule().GetUUIDString())
-        self.assertTrue(addr_line1.GetModule().GetUUIDString()
-                        == addr_line2.GetModule().GetUUIDString())
+        self.assertEqual(addr_line1.GetModule().GetUUIDString(),
+                         addr_line2.GetModule().GetUUIDString())

diff  --git a/lldb/test/API/python_api/module_section/TestModuleAndSection.py b/lldb/test/API/python_api/module_section/TestModuleAndSection.py
index 493d372408c58..377640faf66d5 100644
--- a/lldb/test/API/python_api/module_section/TestModuleAndSection.py
+++ b/lldb/test/API/python_api/module_section/TestModuleAndSection.py
@@ -153,6 +153,5 @@ def find_compile_units(self, exe):
             for source_name in source_name_list:
                 list = module.FindCompileUnits(lldb.SBFileSpec(source_name, False))
                 for sc in list:
-                    self.assertTrue(
-                        sc.GetCompileUnit().GetFileSpec().GetFilename() ==
-                        source_name)
+                    self.assertEqual(
+                        sc.GetCompileUnit().GetFileSpec().GetFilename(), source_name)

diff  --git a/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py b/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py
index beda712f49c7a..e84a808c371f0 100644
--- a/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py
+++ b/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py
@@ -31,15 +31,15 @@ def test_read_memory_c_string(self):
 
         empty_str_addr = frame.FindVariable("empty_string").GetValueAsUnsigned(err)
         self.assertSuccess(err)
-        self.assertTrue(empty_str_addr != lldb.LLDB_INVALID_ADDRESS)
+        self.assertNotEqual(empty_str_addr, lldb.LLDB_INVALID_ADDRESS)
 
         one_letter_str_addr = frame.FindVariable("one_letter_string").GetValueAsUnsigned(err)
         self.assertSuccess(err)
-        self.assertTrue(one_letter_str_addr != lldb.LLDB_INVALID_ADDRESS)
+        self.assertNotEqual(one_letter_str_addr, lldb.LLDB_INVALID_ADDRESS)
 
         invalid_memory_str_addr = frame.FindVariable("invalid_memory_string").GetValueAsUnsigned(err)
         self.assertSuccess(err)
-        self.assertTrue(invalid_memory_str_addr != lldb.LLDB_INVALID_ADDRESS)
+        self.assertNotEqual(invalid_memory_str_addr, lldb.LLDB_INVALID_ADDRESS)
 
         # Important:  An empty (0-length) c-string must come back as a Python string, not a
         # None object.

diff  --git a/lldb/test/API/python_api/sbdata/TestSBData.py b/lldb/test/API/python_api/sbdata/TestSBData.py
index ae873129e219f..932781b9b1b0f 100644
--- a/lldb/test/API/python_api/sbdata/TestSBData.py
+++ b/lldb/test/API/python_api/sbdata/TestSBData.py
@@ -118,10 +118,8 @@ def test_with_run_command(self):
         offset += 4
         self.assert_data(data.GetSignedInt32, offset, 7)
         offset += 8
-        self.assertTrue(
-            data.GetUnsignedInt32(
-                error,
-                offset) == 0,
+        self.assertEqual(
+            data.GetUnsignedInt32(error, offset), 0,
             'do not read beyond end')
         self.assertTrue(not error.Success())
         error.Clear()  # clear the error for the next test
@@ -287,22 +285,15 @@ def test_with_run_command(self):
             self.assert_data(data2.GetUnsignedInt64, 24, 4)
             self.assert_data(data2.GetUnsignedInt64, 32, 5)
 
-            self.assertTrue(
-                data2.uint64s == [
-                    1,
-                    2,
-                    3,
-                    4,
-                    5],
+            self.assertEqual(
+                data2.uint64s, [1, 2, 3, 4, 5],
                 'read_data_helper failure: data2 == [1,2,3,4,5]')
 
         for l in int_lists:
             data2 = lldb.SBData.CreateDataFromSInt32Array(
                 process.GetByteOrder(), process.GetAddressByteSize(), l)
-            self.assertTrue(
-                data2.sint32[
-                    0:2] == [
-                    2, -2], 'signed32 data2 = [2,-2]')
+            self.assertEqual(
+                data2.sint32[0:2], [2, -2], 'signed32 data2 = [2,-2]')
 
         data2.Append(
             lldb.SBData.CreateDataFromSInt64Array(
@@ -311,20 +302,16 @@ def test_with_run_command(self):
                 int_lists[0]))
         self.assert_data(data2.GetSignedInt32, 0, 2)
         self.assert_data(data2.GetSignedInt32, 4, -2)
-        self.assertTrue(
-            data2.sint64[
-                1:3] == [
-                2, -2], 'signed64 data2 = [2,-2]')
+        self.assertEqual(
+            data2.sint64[1:3], [2, -2], 'signed64 data2 = [2,-2]')
 
         for l in int_lists:
             data2 = lldb.SBData.CreateDataFromSInt64Array(
                 process.GetByteOrder(), process.GetAddressByteSize(), l)
             self.assert_data(data2.GetSignedInt64, 0, 2)
             self.assert_data(data2.GetSignedInt64, 8, -2)
-            self.assertTrue(
-                data2.sint64[
-                    0:2] == [
-                    2, -2], 'signed64 data2 = [2,-2]')
+            self.assertEqual(
+                data2.sint64[0:2], [2, -2], 'signed64 data2 = [2,-2]')
 
         for l in uint_lists:
             data2 = lldb.SBData.CreateDataFromUInt32Array(
@@ -339,54 +326,26 @@ def test_with_run_command(self):
 
         data2 = lldb.SBData.CreateDataFromSInt32Array(
             process.GetByteOrder(), process.GetAddressByteSize(), bool_list)
-        self.assertTrue(
-            data2.sint32[
-                0:6] == [
-                1,
-                1,
-                0,
-                0,
-                1,
-                0],
+        self.assertEqual(
+            data2.sint32[0:6], [1, 1, 0, 0, 1, 0],
             'signed32 data2 = [1, 1, 0, 0, 1, 0]')
 
         data2 = lldb.SBData.CreateDataFromUInt32Array(
             process.GetByteOrder(), process.GetAddressByteSize(), bool_list)
-        self.assertTrue(
-            data2.uint32[
-                0:6] == [
-                1,
-                1,
-                0,
-                0,
-                1,
-                0],
+        self.assertEqual(
+            data2.uint32[0:6], [1, 1, 0, 0, 1, 0],
             'unsigned32 data2 = [1, 1, 0, 0, 1, 0]')
 
         data2 = lldb.SBData.CreateDataFromSInt64Array(
             process.GetByteOrder(), process.GetAddressByteSize(), bool_list)
-        self.assertTrue(
-            data2.sint64[
-                0:6] == [
-                1,
-                1,
-                0,
-                0,
-                1,
-                0],
+        self.assertEqual(
+            data2.sint64[0:6], [1, 1, 0, 0, 1, 0],
             'signed64 data2 = [1, 1, 0, 0, 1, 0]')
 
         data2 = lldb.SBData.CreateDataFromUInt64Array(
             process.GetByteOrder(), process.GetAddressByteSize(), bool_list)
-        self.assertTrue(
-            data2.uint64[
-                0:6] == [
-                1,
-                1,
-                0,
-                0,
-                1,
-                0],
+        self.assertEqual(
+            data2.uint64[0:6], [1, 1, 0, 0, 1, 0],
             'signed64 data2 = [1, 1, 0, 0, 1, 0]')
 
         data2 = lldb.SBData.CreateDataFromDoubleArray(

diff  --git a/lldb/test/API/python_api/value/TestValueAPI.py b/lldb/test/API/python_api/value/TestValueAPI.py
index 98546e8f08f9e..85d8b494e3d3d 100644
--- a/lldb/test/API/python_api/value/TestValueAPI.py
+++ b/lldb/test/API/python_api/value/TestValueAPI.py
@@ -158,10 +158,10 @@ def test(self):
         self.assertFalse(lldb.value(frame0.FindVariable('bogus')))
         self.assertTrue(lldb.value(frame0.FindVariable('uinthex')))
 
-        self.assertTrue(int(lldb.value(frame0.FindVariable('uinthex')))
-                        == 3768803088, 'uinthex == 3768803088')
-        self.assertTrue(int(lldb.value(frame0.FindVariable('sinthex')))
-                        == -526164208, 'sinthex == -526164208')
+        self.assertEqual(int(lldb.value(frame0.FindVariable('uinthex'))),
+                         3768803088, 'uinthex == 3768803088')
+        self.assertEqual(int(lldb.value(frame0.FindVariable('sinthex'))),
+                         -526164208, 'sinthex == -526164208')
 
         # Check value_iter works correctly.
         for v in [
@@ -177,11 +177,9 @@ def test(self):
             frame0.FindVariable('sinthex').GetValueAsUnsigned(), 3768803088,
             'unsigned sinthex == 3768803088')
 
-        self.assertTrue(
-            frame0.FindVariable('uinthex').GetValueAsSigned() == -
-            526164208,
+        self.assertEqual(
+            frame0.FindVariable('uinthex').GetValueAsSigned(), -526164208,
             'signed uinthex == -526164208')
-        self.assertTrue(
-            frame0.FindVariable('sinthex').GetValueAsSigned() == -
-            526164208,
+        self.assertEqual(
+            frame0.FindVariable('sinthex').GetValueAsSigned(), -526164208,
             'signed sinthex == -526164208')

diff  --git a/lldb/test/API/python_api/value_var_update/TestValueVarUpdate.py b/lldb/test/API/python_api/value_var_update/TestValueVarUpdate.py
index cbc91356ec12c..88ddce96b7111 100644
--- a/lldb/test/API/python_api/value_var_update/TestValueVarUpdate.py
+++ b/lldb/test/API/python_api/value_var_update/TestValueVarUpdate.py
@@ -47,8 +47,8 @@ def test_with_process_launch_api(self):
         if self.TraceOn():
             self.runCmd("frame variable")
 
-        self.assertTrue(
-            i_val != i.GetValueAsUnsigned(0),
+        self.assertNotEqual(
+            i_val, i.GetValueAsUnsigned(0),
             "GetValue() is saying a lie")
         self.assertTrue(
             i.GetValueDidChange(),

diff  --git a/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py b/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
index e364f7fbd4754..6e916d72dda7d 100644
--- a/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
+++ b/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
@@ -74,8 +74,8 @@ def test_stopOnEntry(self):
                 body = stopped_event['body']
                 if 'reason' in body:
                     reason = body['reason']
-                    self.assertTrue(
-                        reason != 'breakpoint',
+                    self.assertNotEqual(
+                        reason, 'breakpoint',
                         'verify stop isn\'t "main" breakpoint')
 
     @skipIfWindows


        


More information about the lldb-commits mailing list