diff --git a/lldb/test/API/commands/expression/dont_allow_jit/TestAllowJIT.py b/lldb/test/API/commands/expression/dont_allow_jit/TestAllowJIT.py --- a/lldb/test/API/commands/expression/dont_allow_jit/TestAllowJIT.py +++ b/lldb/test/API/commands/expression/dont_allow_jit/TestAllowJIT.py @@ -69,7 +69,7 @@ # Again use it and ensure we fail: result = frame.EvaluateExpression("call_me(10)", options) self.assertTrue(result.GetError().Fail(), "expression failed with no JIT") - self.assertTrue("Can't evaluate the expression without a running target" in result.GetError().GetCString(), "Got right error") + self.assertIn("Can't evaluate the expression without a running target", result.GetError().GetCString(), "Got right error") # Finally set the allow JIT value back to true and make sure that works: options.SetAllowJIT(True) diff --git a/lldb/test/API/commands/frame/var/TestFrameVar.py b/lldb/test/API/commands/frame/var/TestFrameVar.py --- a/lldb/test/API/commands/frame/var/TestFrameVar.py +++ b/lldb/test/API/commands/frame/var/TestFrameVar.py @@ -64,28 +64,28 @@ result = interp.HandleCommand("frame var -l", command_result) self.assertEqual(result, lldb.eReturnStatusSuccessFinishResult, "frame var -a didn't succeed") output = command_result.GetOutput() - self.assertTrue("argc" in output, "Args didn't find argc") - self.assertTrue("argv" in output, "Args didn't find argv") - self.assertTrue("test_var" not in output, "Args found a local") - self.assertTrue("g_var" not in output, "Args found a global") + self.assertIn("argc", output, "Args didn't find argc") + self.assertIn("argv", output, "Args didn't find argv") + self.assertNotIn("test_var", output, "Args found a local") + self.assertNotIn("g_var", output, "Args found a global") # Just get locals: result = interp.HandleCommand("frame var -a", command_result) self.assertEqual(result, lldb.eReturnStatusSuccessFinishResult, "frame var -a didn't succeed") output = command_result.GetOutput() - self.assertTrue("argc" not in output, "Locals found argc") - self.assertTrue("argv" not in output, "Locals found argv") - self.assertTrue("test_var" in output, "Locals didn't find test_var") - self.assertTrue("g_var" not in output, "Locals found a global") + self.assertNotIn("argc", output, "Locals found argc") + self.assertNotIn("argv", output, "Locals found argv") + self.assertIn("test_var", output, "Locals didn't find test_var") + self.assertNotIn("g_var", output, "Locals found a global") # Get the file statics: result = interp.HandleCommand("frame var -l -a -g", command_result) self.assertEqual(result, lldb.eReturnStatusSuccessFinishResult, "frame var -a didn't succeed") output = command_result.GetOutput() - self.assertTrue("argc" not in output, "Globals found argc") - self.assertTrue("argv" not in output, "Globals found argv") - self.assertTrue("test_var" not in output, "Globals found test_var") - self.assertTrue("g_var" in output, "Globals didn't find g_var") + self.assertNotIn("argc", output, "Globals found argc") + self.assertNotIn("argv", output, "Globals found argv") + self.assertNotIn("test_var", output, "Globals found test_var") + self.assertIn("g_var", output, "Globals didn't find g_var") diff --git a/lldb/test/API/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py b/lldb/test/API/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py --- a/lldb/test/API/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py +++ b/lldb/test/API/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py @@ -288,14 +288,14 @@ name_list = lldb.SBStringList() self.target.GetBreakpointNames(name_list) for name_string in [self.bp_name_string, other_bp_name_string, cl_bp_name_string]: - self.assertTrue(name_string in name_list, "Didn't find %s in names"%(name_string)) + self.assertIn(name_string, name_list, "Didn't find %s in names"%(name_string)) # Delete the name from the current target. Make sure that works and deletes the # name from the breakpoint as well: self.target.DeleteBreakpointName(self.bp_name_string) name_list.Clear() self.target.GetBreakpointNames(name_list) - self.assertTrue(self.bp_name_string not in name_list, "Didn't delete %s from a real target"%(self.bp_name_string)) + self.assertNotIn(self.bp_name_string, name_list, "Didn't delete %s from a real target"%(self.bp_name_string)) # Also make sure the name got removed from breakpoints holding it: self.assertFalse(bkpt.MatchesName(self.bp_name_string), "Didn't remove the name from the breakpoint.") @@ -305,7 +305,7 @@ dummy_target.DeleteBreakpointName(self.bp_name_string) name_list.Clear() dummy_target.GetBreakpointNames(name_list) - self.assertTrue(self.bp_name_string not in name_list, "Didn't delete %s from the dummy target"%(self.bp_name_string)) + self.assertNotIn(self.bp_name_string, name_list, "Didn't delete %s from the dummy target"%(self.bp_name_string)) # Also make sure the name got removed from breakpoints holding it: self.assertFalse(bkpt.MatchesName(self.bp_name_string), "Didn't remove the name from the breakpoint.") diff --git a/lldb/test/API/functionalities/breakpoint/debugbreak/TestDebugBreak.py b/lldb/test/API/functionalities/breakpoint/debugbreak/TestDebugBreak.py --- a/lldb/test/API/functionalities/breakpoint/debugbreak/TestDebugBreak.py +++ b/lldb/test/API/functionalities/breakpoint/debugbreak/TestDebugBreak.py @@ -37,8 +37,8 @@ # We should be in funciton 'bar'. self.assertTrue(frame.IsValid()) function_name = frame.GetFunctionName() - self.assertTrue('bar' in function_name, - "Unexpected function name {}".format(function_name)) + self.assertIn('bar', function_name, + "Unexpected function name {}".format(function_name)) # We should be able to evaluate the parameter foo. value = frame.EvaluateExpression('*foo') diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/TestDataFormatterLibcxxQueue.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/TestDataFormatterLibcxxQueue.py --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/TestDataFormatterLibcxxQueue.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/TestDataFormatterLibcxxQueue.py @@ -23,7 +23,7 @@ self.assertTrue(var.IsValid()) queue = self.namespace + '::queue' - self.assertTrue(queue in var.GetDisplayTypeName()) + self.assertIn(queue, var.GetDisplayTypeName()) self.assertEqual(var.GetNumChildren(), 5) for i in range(5): ch = var.GetChildAtIndex(i) diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py --- a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py +++ b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py @@ -96,7 +96,7 @@ process = self.connect(target) self.read_registers(process) - self.assertFalse("g" in self.server.responder.packetLog) + self.assertNotIn("g", self.server.responder.packetLog) self.assertGreater( len([p for p in self.server.responder.packetLog if p.startswith("p")]), 0) diff --git a/lldb/test/API/functionalities/history/TestHistoryRecall.py b/lldb/test/API/functionalities/history/TestHistoryRecall.py --- a/lldb/test/API/functionalities/history/TestHistoryRecall.py +++ b/lldb/test/API/functionalities/history/TestHistoryRecall.py @@ -30,8 +30,8 @@ interp.HandleCommand("!0", result, False) self.assertTrue(result.Succeeded(), "!0 command did not work: %s"%(result.GetError())) - self.assertTrue("session history" in result.GetOutput(), "!0 didn't rerun session history") + self.assertIn("session history", result.GetOutput(), "!0 didn't rerun session history") interp.HandleCommand("!-1", result, False) self.assertTrue(result.Succeeded(), "!-1 command did not work: %s"%(result.GetError())) - self.assertTrue("host:" in result.GetOutput(), "!-1 didn't rerun platform list.") + self.assertIn("host:", result.GetOutput(), "!-1 didn't rerun platform list.") diff --git a/lldb/test/API/functionalities/plugins/python_os_plugin/stepping_plugin_threads/TestOSPluginStepping.py b/lldb/test/API/functionalities/plugins/python_os_plugin/stepping_plugin_threads/TestOSPluginStepping.py --- a/lldb/test/API/functionalities/plugins/python_os_plugin/stepping_plugin_threads/TestOSPluginStepping.py +++ b/lldb/test/API/functionalities/plugins/python_os_plugin/stepping_plugin_threads/TestOSPluginStepping.py @@ -113,6 +113,6 @@ self.process.Continue() os_thread = self.get_os_thread() self.assertTrue(os_thread.IsValid(), "The OS thread is back after continue") - self.assertTrue("step out" in os_thread.GetStopDescription(100), "Completed step out plan") + self.assertIn("step out", os_thread.GetStopDescription(100), "Completed step out plan") diff --git a/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py b/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py --- a/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py +++ b/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py @@ -110,7 +110,7 @@ ci.HandleCommand(command, result, False) message = 'Ensure memory "%s" shows up in output for "%s"' % ( region_name, command) - self.assertTrue(region_name in result.GetOutput(), message) + self.assertIn(region_name, result.GetOutput(), message) def test_thread_info_in_minidump(self): """Test that lldb can read the thread information from the Minidump.""" @@ -122,7 +122,7 @@ thread = self.process.GetThreadAtIndex(0) self.assertEqual(thread.GetStopReason(), lldb.eStopReasonSignal) stop_description = thread.GetStopDescription(256) - self.assertTrue("SIGSEGV" in stop_description) + self.assertIn("SIGSEGV", stop_description) def test_stack_info_in_minidump(self): """Test that we can see a trivial stack in a breakpad-generated Minidump.""" @@ -333,7 +333,7 @@ frame = thread.GetFrameAtIndex(index) self.assertTrue(frame.IsValid()) function_name = frame.GetFunctionName() - self.assertTrue(name in function_name) + self.assertIn(name, function_name) @skipIfLLVMTargetMissing("X86") def test_deeper_stack_in_minidump(self): diff --git a/lldb/test/API/functionalities/postmortem/minidump/TestMiniDump.py b/lldb/test/API/functionalities/postmortem/minidump/TestMiniDump.py --- a/lldb/test/API/functionalities/postmortem/minidump/TestMiniDump.py +++ b/lldb/test/API/functionalities/postmortem/minidump/TestMiniDump.py @@ -38,7 +38,7 @@ thread = self.process.GetThreadAtIndex(0) self.assertEqual(thread.GetStopReason(), lldb.eStopReasonException) stop_description = thread.GetStopDescription(256) - self.assertTrue("0xc0000005" in stop_description) + self.assertIn("0xc0000005", stop_description) def test_modules_in_mini_dump(self): """Test that lldb can read the list of modules from the minidump.""" @@ -136,7 +136,7 @@ frame = thread.GetFrameAtIndex(index) self.assertTrue(frame.IsValid()) function_name = frame.GetFunctionName() - self.assertTrue(name in function_name) + self.assertIn(name, function_name) finally: # Clean up the mini dump file. diff --git a/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py b/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py --- a/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py +++ b/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py @@ -56,7 +56,7 @@ os.path.join( f.GetDirectory(), f.GetFilename()) for f in files] - self.assertTrue(exe in paths) + self.assertIn(exe, paths) finally: # Clean up the mini dump file. diff --git a/lldb/test/API/functionalities/source-map/TestTargetSourceMap.py b/lldb/test/API/functionalities/source-map/TestTargetSourceMap.py --- a/lldb/test/API/functionalities/source-map/TestTargetSourceMap.py +++ b/lldb/test/API/functionalities/source-map/TestTargetSourceMap.py @@ -24,7 +24,7 @@ self.dbg.GetCommandInterpreter().HandleCommand("source list -f main.c -l 2", retval) self.assertTrue(retval.Succeeded(), "source list didn't succeed.") self.assertNotEqual(retval.GetOutput(), None, "We got no ouput from source list") - self.assertTrue("return" in retval.GetOutput(), "We didn't find the source file...") + self.assertIn("return", retval.GetOutput(), "We didn't find the source file...") # Set the target soure map to map "./" to the current test directory src_dir = self.getSourceDir() diff --git a/lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py b/lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py --- a/lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py +++ b/lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py @@ -28,7 +28,7 @@ res = stats.GetAsJSON(stream) stats_json = sorted(json.loads(stream.GetData())) self.assertEqual(len(stats_json), 4) - self.assertTrue("Number of expr evaluation failures" in stats_json) - self.assertTrue("Number of expr evaluation successes" in stats_json) - self.assertTrue("Number of frame var failures" in stats_json) - self.assertTrue("Number of frame var successes" in stats_json) + self.assertIn("Number of expr evaluation failures", stats_json) + self.assertIn("Number of expr evaluation successes", stats_json) + self.assertIn("Number of frame var failures", stats_json) + self.assertIn("Number of frame var successes", stats_json) diff --git a/lldb/test/API/functionalities/step_scripted/TestStepScripted.py b/lldb/test/API/functionalities/step_scripted/TestStepScripted.py --- a/lldb/test/API/functionalities/step_scripted/TestStepScripted.py +++ b/lldb/test/API/functionalities/step_scripted/TestStepScripted.py @@ -59,7 +59,7 @@ # Make sure we got a good error: self.assertTrue(err.Fail(), "We got a failure state") msg = err.GetCString() - self.assertTrue("NoSuchModule.NoSuchPlan" in msg, "Mentioned missing class") + self.assertIn("NoSuchModule.NoSuchPlan", msg, "Mentioned missing class") # Make sure we didn't let the process run: self.assertEqual(stop_id, process.GetStopID(), "Process didn't run") diff --git a/lldb/test/API/functionalities/tail_call_frames/cross_dso/TestCrossDSOTailCalls.py b/lldb/test/API/functionalities/tail_call_frames/cross_dso/TestCrossDSOTailCalls.py --- a/lldb/test/API/functionalities/tail_call_frames/cross_dso/TestCrossDSOTailCalls.py +++ b/lldb/test/API/functionalities/tail_call_frames/cross_dso/TestCrossDSOTailCalls.py @@ -61,5 +61,5 @@ ] for idx, (name, is_artificial) in enumerate(expected_frames): frame = thread.GetFrameAtIndex(idx) - self.assertTrue(name in frame.GetDisplayFunctionName()) + self.assertIn(name, frame.GetDisplayFunctionName()) self.assertEqual(frame.IsArtificial(), is_artificial) diff --git a/lldb/test/API/functionalities/tail_call_frames/cross_object/TestCrossObjectTailCalls.py b/lldb/test/API/functionalities/tail_call_frames/cross_object/TestCrossObjectTailCalls.py --- a/lldb/test/API/functionalities/tail_call_frames/cross_object/TestCrossObjectTailCalls.py +++ b/lldb/test/API/functionalities/tail_call_frames/cross_object/TestCrossObjectTailCalls.py @@ -56,5 +56,5 @@ ] for idx, (name, is_artificial) in enumerate(expected_frames): frame = thread.GetFrameAtIndex(idx) - self.assertTrue(name in frame.GetDisplayFunctionName()) + self.assertIn(name, frame.GetDisplayFunctionName()) self.assertEqual(frame.IsArtificial(), is_artificial) diff --git a/lldb/test/API/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py b/lldb/test/API/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py --- a/lldb/test/API/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py +++ b/lldb/test/API/functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py @@ -61,5 +61,5 @@ # platform-dependent. E.g we see "void sink(void)" on Windows, but # "sink()" on Darwin. This seems like a bug -- just work around it # for now. - self.assertTrue(name in frame.GetDisplayFunctionName()) + self.assertIn(name, frame.GetDisplayFunctionName()) self.assertEqual(frame.IsArtificial(), is_artificial) diff --git a/lldb/test/API/functionalities/tsan/basic/TestTsanBasic.py b/lldb/test/API/functionalities/tsan/basic/TestTsanBasic.py --- a/lldb/test/API/functionalities/tsan/basic/TestTsanBasic.py +++ b/lldb/test/API/functionalities/tsan/basic/TestTsanBasic.py @@ -63,7 +63,7 @@ process = self.dbg.GetSelectedTarget().process thread = process.GetSelectedThread() frame = thread.GetSelectedFrame() - self.assertTrue("__tsan_on_report" in frame.GetFunctionName()) + self.assertIn("__tsan_on_report", frame.GetFunctionName()) # The stopped thread backtrace should contain either line1 or line2 # from main.c. diff --git a/lldb/test/API/functionalities/ubsan/basic/TestUbsanBasic.py b/lldb/test/API/functionalities/ubsan/basic/TestUbsanBasic.py --- a/lldb/test/API/functionalities/ubsan/basic/TestUbsanBasic.py +++ b/lldb/test/API/functionalities/ubsan/basic/TestUbsanBasic.py @@ -51,7 +51,7 @@ substrs=['1 match found']) # We should be stopped in __ubsan_on_report - self.assertTrue("__ubsan_on_report" in frame.GetFunctionName()) + self.assertIn("__ubsan_on_report", frame.GetFunctionName()) # The stopped thread backtrace should contain either 'align line' found = False diff --git a/lldb/test/API/lang/c/vla/TestVLA.py b/lldb/test/API/lang/c/vla/TestVLA.py --- a/lldb/test/API/lang/c/vla/TestVLA.py +++ b/lldb/test/API/lang/c/vla/TestVLA.py @@ -24,7 +24,7 @@ var_opts.SetUseDynamic(lldb.eDynamicCanRunTarget) all_locals = self.frame().GetVariables(var_opts) for value in all_locals: - self.assertFalse("vla_expr" in value.name) + self.assertNotIn("vla_expr", value.name) @decorators.skipIf(compiler="clang", compiler_version=['<', '8.0']) def test_vla(self): diff --git a/lldb/test/API/lang/cpp/accelerator-table/TestCPPAccelerator.py b/lldb/test/API/lang/cpp/accelerator-table/TestCPPAccelerator.py --- a/lldb/test/API/lang/cpp/accelerator-table/TestCPPAccelerator.py +++ b/lldb/test/API/lang/cpp/accelerator-table/TestCPPAccelerator.py @@ -29,7 +29,7 @@ n = 0 for line in log: if re.findall(r'[abcdefg]\.o: FindByNameAndTag\(\)', line): - self.assertTrue("d.o" in line) + self.assertIn("d.o", line) n += 1 self.assertEqual(n, 1, log) diff --git a/lldb/test/API/lang/cpp/class_static/TestStaticVariables.py b/lldb/test/API/lang/cpp/class_static/TestStaticVariables.py --- a/lldb/test/API/lang/cpp/class_static/TestStaticVariables.py +++ b/lldb/test/API/lang/cpp/class_static/TestStaticVariables.py @@ -138,7 +138,7 @@ for val in valList: self.DebugSBValue(val) name = val.GetName() - self.assertTrue(name in ['g_points', 'A::g_points']) + self.assertIn(name, ['g_points', 'A::g_points']) if name == 'g_points': self.assertEqual( val.GetValueType(), lldb.eValueTypeVariableStatic) diff --git a/lldb/test/API/lang/cpp/class_types/TestClassTypes.py b/lldb/test/API/lang/cpp/class_types/TestClassTypes.py --- a/lldb/test/API/lang/cpp/class_types/TestClassTypes.py +++ b/lldb/test/API/lang/cpp/class_types/TestClassTypes.py @@ -220,5 +220,5 @@ frame = thread.frames[0] self.assertTrue(frame.IsValid(), "Got a valid frame.") - self.assertTrue("C::C" in frame.name, - "Constructor name includes class name.") + self.assertIn("C::C", frame.name, + "Constructor name includes class name.") diff --git a/lldb/test/API/lang/objc/direct-dispatch-step/TestObjCDirectDispatchStepping.py b/lldb/test/API/lang/objc/direct-dispatch-step/TestObjCDirectDispatchStepping.py --- a/lldb/test/API/lang/objc/direct-dispatch-step/TestObjCDirectDispatchStepping.py +++ b/lldb/test/API/lang/objc/direct-dispatch-step/TestObjCDirectDispatchStepping.py @@ -36,7 +36,7 @@ for idx in range(2,16): thread.StepInto() func_name = thread.GetFrameAtIndex(0).GetFunctionName() - self.assertTrue("OverridesALot" in func_name, "%d'th step did not match name: %s"%(idx, func_name)) + self.assertIn("OverridesALot", func_name, "%d'th step did not match name: %s"%(idx, func_name)) stop_threads = lldbutil.continue_to_breakpoint(process, stop_bkpt) self.assertEqual(len(stop_threads), 1) self.assertEqual(stop_threads[0], thread) diff --git a/lldb/test/API/lang/objc/exceptions/TestObjCExceptions.py b/lldb/test/API/lang/objc/exceptions/TestObjCExceptions.py --- a/lldb/test/API/lang/objc/exceptions/TestObjCExceptions.py +++ b/lldb/test/API/lang/objc/exceptions/TestObjCExceptions.py @@ -123,7 +123,7 @@ pcs = [i.unsigned for i in children] names = [target.ResolveSymbolContextForAddress(lldb.SBAddress(pc, target), lldb.eSymbolContextSymbol).GetSymbol().name for pc in pcs] for n in ["objc_exception_throw", "foo(int)", "main"]: - self.assertTrue(n in names, "%s is in the exception backtrace (%s)" % (n, names)) + self.assertIn(n, names, "%s is in the exception backtrace (%s)" % (n, names)) def test_objc_exceptions_at_abort(self): self.build() diff --git a/lldb/test/API/lang/objc/objc-checker/TestObjCCheckers.py b/lldb/test/API/lang/objc/objc-checker/TestObjCCheckers.py --- a/lldb/test/API/lang/objc/objc-checker/TestObjCCheckers.py +++ b/lldb/test/API/lang/objc/objc-checker/TestObjCCheckers.py @@ -73,7 +73,7 @@ # Make sure the error is helpful: err_string = expr_error.GetCString() - self.assertTrue("selector" in err_string) + self.assertIn("selector", err_string) # # Check that we correctly insert the checker for an diff --git a/lldb/test/API/macosx/macCatalyst/TestMacCatalyst.py b/lldb/test/API/macosx/macCatalyst/TestMacCatalyst.py --- a/lldb/test/API/macosx/macCatalyst/TestMacCatalyst.py +++ b/lldb/test/API/macosx/macCatalyst/TestMacCatalyst.py @@ -31,7 +31,7 @@ def check_debugserver(self, log): """scan the debugserver packet log""" process_info = lldbutil.packetlog_get_process_info(log) - self.assertTrue('ostype' in process_info) + self.assertIn('ostype', process_info) self.assertEquals(process_info['ostype'], 'maccatalyst') aout_info = None diff --git a/lldb/test/API/macosx/macCatalystAppMacOSFramework/TestMacCatalystAppWithMacOSFramework.py b/lldb/test/API/macosx/macCatalystAppMacOSFramework/TestMacCatalystAppWithMacOSFramework.py --- a/lldb/test/API/macosx/macCatalystAppMacOSFramework/TestMacCatalystAppWithMacOSFramework.py +++ b/lldb/test/API/macosx/macCatalystAppMacOSFramework/TestMacCatalystAppWithMacOSFramework.py @@ -34,7 +34,7 @@ def check_debugserver(self, log): """scan the debugserver packet log""" process_info = lldbutil.packetlog_get_process_info(log) - self.assertTrue('ostype' in process_info) + self.assertIn('ostype', process_info) self.assertEquals(process_info['ostype'], 'maccatalyst') aout_info = None diff --git a/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py b/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py --- a/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py +++ b/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py @@ -29,7 +29,7 @@ def check_debugserver(self, log, expected_platform, expected_version): """scan the debugserver packet log""" process_info = lldbutil.packetlog_get_process_info(log) - self.assertTrue('ostype' in process_info) + self.assertIn('ostype', process_info) self.assertEquals(process_info['ostype'], expected_platform) dylib_info = lldbutil.packetlog_get_dylib_info(log) self.assertTrue(dylib_info) diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteAuxvSupport.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteAuxvSupport.py --- a/lldb/test/API/tools/lldb-server/TestGdbRemoteAuxvSupport.py +++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteAuxvSupport.py @@ -35,7 +35,7 @@ proc_info = self.parse_process_info_response(context) self.assertIsNotNone(proc_info) - self.assertTrue("ptrsize" in proc_info) + self.assertIn("ptrsize", proc_info) word_size = int(proc_info["ptrsize"]) OFFSET = 0 diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py --- a/lldb/test/API/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py +++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py @@ -54,7 +54,7 @@ self.assertIsNotNone(reg_info) # Ensure the expedited registers contained it. - self.assertTrue(reg_info["lldb_register_index"] in expedited_registers) + self.assertIn(reg_info["lldb_register_index"], expedited_registers) self.trace("{} reg_info:{}".format(generic_register_name, reg_info)) def test_stop_notification_contains_any_registers(self): @@ -121,5 +121,5 @@ self.assertIsNotNone(reg_info) # Ensure the expedited registers contained it. - self.assertTrue(reg_info["lldb_register_index"] in expedited_registers) + self.assertIn(reg_info["lldb_register_index"], expedited_registers) self.trace("{} reg_info:{}".format('vg', reg_info)) diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteHostInfo.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteHostInfo.py --- a/lldb/test/API/tools/lldb-server/TestGdbRemoteHostInfo.py +++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteHostInfo.py @@ -66,8 +66,8 @@ # Validate keys are known. for (key, val) in list(host_info_dict.items()): - self.assertTrue(key in self.KNOWN_HOST_INFO_KEYS, - "unknown qHostInfo key: " + key) + self.assertIn(key, self.KNOWN_HOST_INFO_KEYS, + "unknown qHostInfo key: " + key) self.assertIsNotNone(val) # Return the key:val pairs. diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemote_vCont.py b/lldb/test/API/tools/lldb-server/TestGdbRemote_vCont.py --- a/lldb/test/API/tools/lldb-server/TestGdbRemote_vCont.py +++ b/lldb/test/API/tools/lldb-server/TestGdbRemote_vCont.py @@ -22,7 +22,7 @@ self.assertIsNotNone(supported_vCont_modes) # Verify we support the given mode. - self.assertTrue(mode in supported_vCont_modes) + self.assertIn(mode, supported_vCont_modes) def test_vCont_supports_c(self): diff --git a/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py b/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py --- a/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py +++ b/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py @@ -158,17 +158,17 @@ reg_info['generic']: 1 for reg_info in reg_infos if 'generic' in reg_info} # Ensure we have a program counter register. - self.assertTrue('pc' in generic_regs) + self.assertIn('pc', generic_regs) # Ensure we have a frame pointer register. PPC64le's FP is the same as SP if self.getArchitecture() != 'powerpc64le': - self.assertTrue('fp' in generic_regs) + self.assertIn('fp', generic_regs) # Ensure we have a stack pointer register. - self.assertTrue('sp' in generic_regs) + self.assertIn('sp', generic_regs) # Ensure we have a flags register. - self.assertTrue('flags' in generic_regs) + self.assertIn('flags', generic_regs) def test_qRegisterInfo_contains_at_least_one_register_set(self): self.build() @@ -442,7 +442,7 @@ # Ensure we haven't seen this tid yet. thread_id = int(context.get("thread_id"), 16) - self.assertFalse(thread_id in signaled_tids) + self.assertNotIn(thread_id, signaled_tids) signaled_tids[thread_id] = 1 # Send SIGUSR1 to the thread that signaled the SIGSEGV. @@ -490,7 +490,7 @@ print_thread_id = context.get("print_thread_id") self.assertIsNotNone(print_thread_id) print_thread_id = int(print_thread_id, 16) - self.assertFalse(print_thread_id in print_thread_ids) + self.assertNotIn(print_thread_id, print_thread_ids) # Now remember this print (i.e. inferior-reflected) thread id and # ensure we don't hit it again. @@ -629,12 +629,12 @@ mem_region_dict = self.parse_memory_region_packet(context) # Ensure there are no errors reported. - self.assertFalse("error" in mem_region_dict) + self.assertNotIn("error", mem_region_dict) # Ensure code address is readable and executable. - self.assertTrue("permissions" in mem_region_dict) - self.assertTrue("r" in mem_region_dict["permissions"]) - self.assertTrue("x" in mem_region_dict["permissions"]) + self.assertIn("permissions", mem_region_dict) + self.assertIn("r", mem_region_dict["permissions"]) + self.assertIn("x", mem_region_dict["permissions"]) # Ensure the start address and size encompass the address we queried. self.assert_address_within_memory_region(code_address, mem_region_dict) @@ -681,12 +681,12 @@ mem_region_dict = self.parse_memory_region_packet(context) # Ensure there are no errors reported. - self.assertFalse("error" in mem_region_dict) + self.assertNotIn("error", mem_region_dict) # Ensure address is readable and executable. - self.assertTrue("permissions" in mem_region_dict) - self.assertTrue("r" in mem_region_dict["permissions"]) - self.assertTrue("w" in mem_region_dict["permissions"]) + self.assertIn("permissions", mem_region_dict) + self.assertIn("r", mem_region_dict["permissions"]) + self.assertIn("w", mem_region_dict["permissions"]) # Ensure the start address and size encompass the address we queried. self.assert_address_within_memory_region( @@ -734,12 +734,12 @@ mem_region_dict = self.parse_memory_region_packet(context) # Ensure there are no errors reported. - self.assertFalse("error" in mem_region_dict) + self.assertNotIn("error", mem_region_dict) # Ensure address is readable and executable. - self.assertTrue("permissions" in mem_region_dict) - self.assertTrue("r" in mem_region_dict["permissions"]) - self.assertTrue("w" in mem_region_dict["permissions"]) + self.assertIn("permissions", mem_region_dict) + self.assertIn("r", mem_region_dict["permissions"]) + self.assertIn("w", mem_region_dict["permissions"]) # Ensure the start address and size encompass the address we queried. self.assert_address_within_memory_region(heap_address, mem_region_dict) diff --git a/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.py b/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.py --- a/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.py +++ b/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.py @@ -127,7 +127,7 @@ self.assertTrue(line, lines[index]) # Store the "id" of the breakpoint that was set for later line_to_id[line] = breakpoint['id'] - self.assertTrue(line in lines, "line expected in lines array") + self.assertIn(line, lines, "line expected in lines array") self.assertTrue(breakpoint['verified'], "expect breakpoint verified") @@ -153,7 +153,7 @@ # making sure the breakpoint ID didn't change self.assertEquals(line_to_id[line], breakpoint['id'], "verify previous breakpoints stayed the same") - self.assertTrue(line in lines, "line expected in lines array") + self.assertIn(line, lines, "line expected in lines array") self.assertTrue(breakpoint['verified'], "expect breakpoint still verified") @@ -172,7 +172,7 @@ # making sure the breakpoint ID didn't change self.assertEquals(line_to_id[line], breakpoint['id'], "verify previous breakpoints stayed the same") - self.assertTrue(line in lines, "line expected in lines array") + self.assertIn(line, lines, "line expected in lines array") self.assertTrue(breakpoint['verified'], "expect breakpoint still verified") @@ -202,7 +202,7 @@ "expect %u source breakpoints" % (len(lines))) for breakpoint in breakpoints: line = breakpoint['line'] - self.assertTrue(line in lines, "line expected in lines array") + self.assertIn(line, lines, "line expected in lines array") self.assertTrue(breakpoint['verified'], "expect breakpoint still verified") @@ -217,7 +217,7 @@ "expect %u source breakpoints" % (len(lines))) for breakpoint in breakpoints: line = breakpoint['line'] - self.assertTrue(line in lines, "line expected in lines array") + self.assertIn(line, lines, "line expected in lines array") self.assertTrue(breakpoint['verified'], "expect breakpoint still verified") @@ -248,7 +248,7 @@ self.assertTrue(line, lines[index]) # Store the "id" of the breakpoint that was set for later line_to_id[line] = breakpoint['id'] - self.assertTrue(line in lines, "line expected in lines array") + self.assertIn(line, lines, "line expected in lines array") self.assertTrue(breakpoint['verified'], "expect breakpoint verified") diff --git a/lldb/test/API/tools/lldb-vscode/console/TestVSCode_console.py b/lldb/test/API/tools/lldb-vscode/console/TestVSCode_console.py --- a/lldb/test/API/tools/lldb-vscode/console/TestVSCode_console.py +++ b/lldb/test/API/tools/lldb-vscode/console/TestVSCode_console.py @@ -19,10 +19,10 @@ def check_lldb_command(self, lldb_command, contains_string, assert_msg): response = self.vscode.request_evaluate('`%s' % (lldb_command)) output = response['body']['result'] - self.assertTrue(contains_string in output, - ("""Verify %s by checking the command output:\n""" - """'''\n%s'''\nfor the string: "%s" """ % ( - assert_msg, output, contains_string))) + self.assertIn(contains_string, output, + ("""Verify %s by checking the command output:\n""" + """'''\n%s'''\nfor the string: "%s" """ % ( + assert_msg, output, contains_string))) @skipIfWindows @skipIfRemote diff --git a/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py b/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py --- a/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py +++ b/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py @@ -33,8 +33,8 @@ self.assertTrue(output and len(output) > 0, "expect program output") lines = output.splitlines() - self.assertTrue(program in lines[0], - "make sure program path is in first argument") + self.assertIn(program, lines[0], + "make sure program path is in first argument") @skipIfWindows @skipIfRemote @@ -104,9 +104,9 @@ if line.startswith('cwd = \"'): quote_path = '"%s"' % (program_parent_dir) found = True - self.assertTrue(quote_path in line, - "working directory '%s' not in '%s'" % ( - program_parent_dir, line)) + self.assertIn(quote_path, line, + "working directory '%s' not in '%s'" % ( + program_parent_dir, line)) self.assertTrue(found, "verified program working directory") @skipIfWindows @@ -202,9 +202,9 @@ for line in lines: quote_path = '"%s"' % (program) if line.startswith("arg[1] ="): - self.assertTrue(quote_path in line, - 'verify "%s" expanded to "%s"' % ( - glob, program)) + self.assertIn(quote_path, line, + 'verify "%s" expanded to "%s"' % ( + glob, program)) @skipIfWindows @skipIfRemote @@ -228,9 +228,9 @@ for line in lines: quote_path = '"%s"' % (glob) if line.startswith("arg[1] ="): - self.assertTrue(quote_path in line, - 'verify "%s" stayed to "%s"' % ( - glob, glob)) + self.assertIn(quote_path, line, + 'verify "%s" stayed to "%s"' % ( + glob, glob)) @skipIfWindows @skipIfRemote @@ -255,8 +255,8 @@ # Make sure arguments we specified are correct for (i, arg) in enumerate(args): quoted_arg = '"%s"' % (arg) - self.assertTrue(quoted_arg in lines[i], - 'arg[%i] "%s" not in "%s"' % (i+1, quoted_arg, lines[i])) + self.assertIn(quoted_arg, lines[i], + 'arg[%i] "%s" not in "%s"' % (i+1, quoted_arg, lines[i])) @skipIfWindows @skipIfRemote diff --git a/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py b/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py --- a/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py +++ b/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py @@ -31,7 +31,7 @@ self.assertEqual(program_basename, program_module['name']) self.assertIn('path', program_module, 'make sure path is in module') self.assertEqual(program, program_module['path']) - self.assertTrue('symbolFilePath' not in program_module, 'Make sure a.out.stripped has no debug info') + self.assertNotIn('symbolFilePath', program_module, 'Make sure a.out.stripped has no debug info') symbols_path = self.getBuildArtifact(symbol_basename) self.vscode.request_evaluate('`%s' % ('target symbols add -s "%s" "%s"' % (program, symbols_path))) diff --git a/lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py b/lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py --- a/lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py +++ b/lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py @@ -69,8 +69,8 @@ def verify_variables(self, verify_dict, variables, varref_dict=None): for variable in variables: name = variable['name'] - self.assertTrue(name in verify_dict, - 'variable "%s" in verify dictionary' % (name)) + self.assertIn(name, verify_dict, + 'variable "%s" in verify dictionary' % (name)) self.verify_values(verify_dict[name], variable, varref_dict) @skipIfWindows