[Lldb-commits] [lldb] 9f4b130 - [lldb] Replace assertTrue(foo in bar) with assertIn(foo, bar)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 11 14:42:03 PDT 2021


Author: Jonas Devlieghere
Date: 2021-08-11T14:40:21-07:00
New Revision: 9f4b130defc17cbb107ca2186ef6b0f0ff649fd3

URL: https://github.com/llvm/llvm-project/commit/9f4b130defc17cbb107ca2186ef6b0f0ff649fd3
DIFF: https://github.com/llvm/llvm-project/commit/9f4b130defc17cbb107ca2186ef6b0f0ff649fd3.diff

LOG: [lldb] Replace assertTrue(foo in bar) with assertIn(foo, bar)

The benefit of using assertIn is an improved error message when the
assertion fails:

  AssertionError: False is not True

becomes

  AssertionError: 'have ints 5 20 20 5' not found in '""'

Added: 
    

Modified: 
    lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py b/lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py
index d313bb9a4f44a..a0822a6e392d9 100644
--- a/lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py
+++ b/lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py
@@ -140,7 +140,7 @@ def test_lc_note(self):
         self.assertEqual(to_be_removed_dirty_data.GetValueAsUnsigned(), 20)
 
         present_heap_buf = f0.FindVariable("present_heap_buf")
-        self.assertTrue("have ints 5 20 20 5" in present_heap_buf.GetSummary())
+        self.assertIn("have ints 5 20 20 5", present_heap_buf.GetSummary())
 
 
         # f1 is to_be_removed() in libto-be-removed.dylib


        


More information about the lldb-commits mailing list