aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api
diff options
context:
space:
mode:
authorDave Lee <davelee.com@gmail.com>2021-02-02 14:46:37 -0800
committerDave Lee <davelee.com@gmail.com>2021-02-03 21:15:08 -0800
commit0ed758b26041ef4ec57e8511d289fb0b84468775 (patch)
tree85ec29e88231671b4dc2bd4443706ca470e97273 /lldb/test/API/python_api
parent9511fa2ddab73c7c93c97df514a00cee5e12e1b2 (diff)
downloadllvm-0ed758b26041ef4ec57e8511d289fb0b84468775.zip
llvm-0ed758b26041ef4ec57e8511d289fb0b84468775.tar.gz
llvm-0ed758b26041ef4ec57e8511d289fb0b84468775.tar.bz2
[lldb] Convert more assertTrue to assertEqual (NFC)
Follow up to D95813, this converts multiline assertTrue to assertEqual. Differential Revision: https://reviews.llvm.org/D95899
Diffstat (limited to 'lldb/test/API/python_api')
-rw-r--r--lldb/test/API/python_api/event/TestEvents.py4
-rw-r--r--lldb/test/API/python_api/formatters/TestFormattersSBAPI.py52
-rw-r--r--lldb/test/API/python_api/frame/TestFrames.py8
-rw-r--r--lldb/test/API/python_api/lldbutil/iter/TestLLDBIterator.py4
-rw-r--r--lldb/test/API/python_api/objc_type/TestObjCType.py12
-rw-r--r--lldb/test/API/python_api/sbdata/TestSBData.py40
-rw-r--r--lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py16
-rw-r--r--lldb/test/API/python_api/signals/TestSignalsAPI.py8
-rw-r--r--lldb/test/API/python_api/target/TestTargetAPI.py12
-rw-r--r--lldb/test/API/python_api/thread/TestThreadAPI.py7
-rw-r--r--lldb/test/API/python_api/value/TestValueAPI.py8
-rw-r--r--lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py8
-rw-r--r--lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py4
-rw-r--r--lldb/test/API/python_api/watchpoint/TestWatchpointIter.py4
14 files changed, 93 insertions, 94 deletions
diff --git a/lldb/test/API/python_api/event/TestEvents.py b/lldb/test/API/python_api/event/TestEvents.py
index 5816fc3..b53163b 100644
--- a/lldb/test/API/python_api/event/TestEvents.py
+++ b/lldb/test/API/python_api/event/TestEvents.py
@@ -62,8 +62,8 @@ class EventAPITestCase(TestBase):
False, # Stop at entry
error) # error
- self.assertTrue(
- process.GetState() == lldb.eStateStopped,
+ self.assertEqual(
+ process.GetState(), lldb.eStateStopped,
PROCESS_STOPPED)
# Create an empty event object.
diff --git a/lldb/test/API/python_api/formatters/TestFormattersSBAPI.py b/lldb/test/API/python_api/formatters/TestFormattersSBAPI.py
index f01d7c45..3f8329c 100644
--- a/lldb/test/API/python_api/formatters/TestFormattersSBAPI.py
+++ b/lldb/test/API/python_api/formatters/TestFormattersSBAPI.py
@@ -128,8 +128,8 @@ class SBFormattersAPITestCase(TestBase):
filter = lldb.SBTypeFilter(0)
filter.AppendExpressionPath("A")
filter.AppendExpressionPath("D")
- self.assertTrue(
- filter.GetNumberOfExpressionPaths() == 2,
+ self.assertEqual(
+ filter.GetNumberOfExpressionPaths(), 2,
"filter with two items does not have two items")
category.AddTypeFilter(lldb.SBTypeNameSpecifier("JustAStruct"), filter)
@@ -180,11 +180,11 @@ class SBFormattersAPITestCase(TestBase):
foo_var.GetDeclaration().IsValid(),
'foo declaration is invalid')
- self.assertTrue(
- foo_var.GetNumChildren() == 2,
+ self.assertEqual(
+ foo_var.GetNumChildren(), 2,
'synthetic value has wrong number of child items (synth)')
- self.assertTrue(
- foo_var.GetChildMemberWithName('X').GetValueAsUnsigned() == 1,
+ self.assertEqual(
+ foo_var.GetChildMemberWithName('X').GetValueAsUnsigned(), 1,
'foo_synth.X has wrong value (synth)')
self.assertFalse(
foo_var.GetChildMemberWithName('B').IsValid(),
@@ -210,14 +210,14 @@ class SBFormattersAPITestCase(TestBase):
).GetSelectedThread().GetSelectedFrame().FindVariable('foo')
self.assertTrue(foo_var.IsValid(), 'could not find foo')
- self.assertTrue(
- foo_var.GetNumChildren() == 2,
+ self.assertEqual(
+ foo_var.GetNumChildren(), 2,
'synthetic value has wrong number of child items (filter)')
- self.assertTrue(
- foo_var.GetChildMemberWithName('X').GetValueAsUnsigned() == 0,
+ self.assertEqual(
+ foo_var.GetChildMemberWithName('X').GetValueAsUnsigned(), 0,
'foo_synth.X has wrong value (filter)')
- self.assertTrue(
- foo_var.GetChildMemberWithName('A').GetValueAsUnsigned() == 1,
+ self.assertEqual(
+ foo_var.GetChildMemberWithName('A').GetValueAsUnsigned(), 1,
'foo_synth.A has wrong value (filter)')
self.assertTrue(filter.ReplaceExpressionPathAtIndex(
@@ -240,20 +240,20 @@ class SBFormattersAPITestCase(TestBase):
foo_var = self.dbg.GetSelectedTarget().GetProcess(
).GetSelectedThread().GetSelectedFrame().FindVariable('foo')
self.assertTrue(foo_var.IsValid(), 'could not find foo')
- self.assertTrue(
- foo_var.GetChildMemberWithName('C').GetValueAsUnsigned() == ord('e'),
+ self.assertEqual(
+ foo_var.GetChildMemberWithName('C').GetValueAsUnsigned(), ord('e'),
'foo_synth.C has wrong value (filter)')
chosen = self.dbg.GetFilterForType(
lldb.SBTypeNameSpecifier("JustAStruct"))
- self.assertTrue(
- chosen.count == 2,
+ self.assertEqual(
+ chosen.count, 2,
"wrong filter found for JustAStruct")
- self.assertTrue(
- chosen.GetExpressionPathAtIndex(0) == 'C',
+ self.assertEqual(
+ chosen.GetExpressionPathAtIndex(0), 'C',
"wrong item at index 0 for JustAStruct")
- self.assertTrue(
- chosen.GetExpressionPathAtIndex(1) == 'F',
+ self.assertEqual(
+ chosen.GetExpressionPathAtIndex(1), 'F',
"wrong item at index 1 for JustAStruct")
self.assertFalse(
@@ -420,8 +420,8 @@ class SBFormattersAPITestCase(TestBase):
self.assertTrue(
summary.IsValid(),
"no summary found for foo* when one was in place")
- self.assertTrue(
- summary.GetData() == "hello static world",
+ self.assertEqual(
+ summary.GetData(), "hello static world",
"wrong summary found for foo*")
self.expect("frame variable e1", substrs=["I am an empty Empty1 {}"])
@@ -475,8 +475,8 @@ class SBFormattersAPITestCase(TestBase):
int_vector = frame.FindVariable("int_vector")
if self.TraceOn():
print(int_vector)
- self.assertTrue(
- int_vector.GetNumChildren() == 0,
+ self.assertEqual(
+ int_vector.GetNumChildren(), 0,
'synthetic vector is empty')
self.runCmd('settings set target.enable-synthetic-value false')
@@ -495,6 +495,6 @@ class SBFormattersAPITestCase(TestBase):
int_vector = frame.FindVariable("int_vector")
if self.TraceOn():
print(int_vector)
- self.assertTrue(
- int_vector.GetNumChildren() == 0,
+ self.assertEqual(
+ int_vector.GetNumChildren(), 0,
'synthetic vector is still empty')
diff --git a/lldb/test/API/python_api/frame/TestFrames.py b/lldb/test/API/python_api/frame/TestFrames.py
index 23de180..c8a58ad 100644
--- a/lldb/test/API/python_api/frame/TestFrames.py
+++ b/lldb/test/API/python_api/frame/TestFrames.py
@@ -88,8 +88,8 @@ class FrameAPITestCase(TestBase):
# instruction as PC.
if self.getArchitecture() in ['arm', 'armv7', 'armv7k']:
pc_value_int &= ~1
- self.assertTrue(
- pc_value_int == frame.GetPC(),
+ self.assertEqual(
+ pc_value_int, frame.GetPC(),
"PC gotten as a value should equal frame's GetPC")
sp_value = gpr_reg_set.GetChildMemberWithName("sp")
self.assertTrue(
@@ -102,8 +102,8 @@ class FrameAPITestCase(TestBase):
process.Continue()
# At this point, the inferior process should have exited.
- self.assertTrue(
- process.GetState() == lldb.eStateExited,
+ self.assertEqual(
+ process.GetState(), lldb.eStateExited,
PROCESS_EXITED)
# Expect to find 'a' on the call stacks two times.
diff --git a/lldb/test/API/python_api/lldbutil/iter/TestLLDBIterator.py b/lldb/test/API/python_api/lldbutil/iter/TestLLDBIterator.py
index 0397b0f..4cd4970 100644
--- a/lldb/test/API/python_api/lldbutil/iter/TestLLDBIterator.py
+++ b/lldb/test/API/python_api/lldbutil/iter/TestLLDBIterator.py
@@ -55,8 +55,8 @@ class LLDBIteratorTestCase(TestBase):
if self.TraceOn():
print("yours[%d]='%s'" % (i, get_description(yours[i])))
print("mine[%d]='%s'" % (i, get_description(mine[i])))
- self.assertTrue(
- yours[i] == mine[i],
+ self.assertEqual(
+ yours[i], mine[i],
"UUID+FileSpec of yours[{0}] and mine[{0}] matches".format(i))
@add_test_categories(['pyapi'])
diff --git a/lldb/test/API/python_api/objc_type/TestObjCType.py b/lldb/test/API/python_api/objc_type/TestObjCType.py
index 8599b8a..aa64244 100644
--- a/lldb/test/API/python_api/objc_type/TestObjCType.py
+++ b/lldb/test/API/python_api/objc_type/TestObjCType.py
@@ -49,12 +49,12 @@ class ObjCSBTypeTestCase(TestBase):
aBar = self.frame().FindVariable("aBar")
aBarType = aBar.GetType()
self.assertTrue(aBarType.IsValid(), "Bar should be a valid data type")
- self.assertTrue(
- aBarType.GetName() == "Bar *",
+ self.assertEqual(
+ aBarType.GetName(), "Bar *",
"Bar has the right name")
- self.assertTrue(
- aBarType.GetNumberOfDirectBaseClasses() == 1,
+ self.assertEqual(
+ aBarType.GetNumberOfDirectBaseClasses(), 1,
"Bar has a superclass")
aFooType = aBarType.GetDirectBaseClassAtIndex(0)
@@ -64,6 +64,6 @@ class ObjCSBTypeTestCase(TestBase):
self.assertEquals(aBarType.GetNumberOfFields(), 1, "Bar has a field")
aBarField = aBarType.GetFieldAtIndex(0)
- self.assertTrue(
- aBarField.GetName() == "_iVar",
+ self.assertEqual(
+ aBarField.GetName(), "_iVar",
"The field has the right name")
diff --git a/lldb/test/API/python_api/sbdata/TestSBData.py b/lldb/test/API/python_api/sbdata/TestSBData.py
index 16381b8..283908f 100644
--- a/lldb/test/API/python_api/sbdata/TestSBData.py
+++ b/lldb/test/API/python_api/sbdata/TestSBData.py
@@ -430,20 +430,20 @@ class SBDataAPICase(TestBase):
self.assert_data(data2.GetUnsignedInt64, 24, 4)
self.assert_data(data2.GetUnsignedInt64, 32, 5)
- self.assertTrue(
- data2.uint64[0] == 1,
+ self.assertEqual(
+ data2.uint64[0], 1,
'read_data_helper failure: set data2[0] = 1')
- self.assertTrue(
- data2.uint64[1] == 2,
+ self.assertEqual(
+ data2.uint64[1], 2,
'read_data_helper failure: set data2[1] = 2')
- self.assertTrue(
- data2.uint64[2] == 3,
+ self.assertEqual(
+ data2.uint64[2], 3,
'read_data_helper failure: set data2[2] = 3')
- self.assertTrue(
- data2.uint64[3] == 4,
+ self.assertEqual(
+ data2.uint64[3], 4,
'read_data_helper failure: set data2[3] = 4')
- self.assertTrue(
- data2.uint64[4] == 5,
+ self.assertEqual(
+ data2.uint64[4], 5,
'read_data_helper failure: set data2[4] = 5')
self.assertTrue(
@@ -468,20 +468,20 @@ class SBDataAPICase(TestBase):
self.assert_data(data2.GetUnsignedInt32, 12, 4)
self.assert_data(data2.GetUnsignedInt32, 16, 5)
- self.assertTrue(
- data2.uint32[0] == 1,
+ self.assertEqual(
+ data2.uint32[0], 1,
'read_data_helper failure: set 32-bit data2[0] = 1')
- self.assertTrue(
- data2.uint32[1] == 2,
+ self.assertEqual(
+ data2.uint32[1], 2,
'read_data_helper failure: set 32-bit data2[1] = 2')
- self.assertTrue(
- data2.uint32[2] == 3,
+ self.assertEqual(
+ data2.uint32[2], 3,
'read_data_helper failure: set 32-bit data2[2] = 3')
- self.assertTrue(
- data2.uint32[3] == 4,
+ self.assertEqual(
+ data2.uint32[3], 4,
'read_data_helper failure: set 32-bit data2[3] = 4')
- self.assertTrue(
- data2.uint32[4] == 5,
+ self.assertEqual(
+ data2.uint32[4], 5,
'read_data_helper failure: set 32-bit data2[4] = 5')
data2.SetDataFromDoubleArray([3.14, 6.28, 2.71])
diff --git a/lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py b/lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py
index 410c6c9..94eec2a 100644
--- a/lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py
+++ b/lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py
@@ -57,11 +57,11 @@ class SBValuePersistTestCase(TestBase):
self.assertTrue(barPersist.IsValid(), "barPersist is not valid")
self.assertTrue(bazPersist.IsValid(), "bazPersist is not valid")
- self.assertTrue(
- fooPersist.GetValueAsUnsigned(0) == 10,
+ self.assertEqual(
+ fooPersist.GetValueAsUnsigned(0), 10,
"fooPersist != 10")
- self.assertTrue(
- barPersist.GetPointeeData().sint32[0] == 4,
+ self.assertEqual(
+ barPersist.GetPointeeData().sint32[0], 4,
"barPersist != 4")
self.assertEquals(bazPersist.GetSummary(), '"85"', "bazPersist != 85")
@@ -71,11 +71,11 @@ class SBValuePersistTestCase(TestBase):
self.assertTrue(barPersist.IsValid(), "barPersist is not valid")
self.assertTrue(bazPersist.IsValid(), "bazPersist is not valid")
- self.assertTrue(
- fooPersist.GetValueAsUnsigned(0) == 10,
+ self.assertEqual(
+ fooPersist.GetValueAsUnsigned(0), 10,
"fooPersist != 10")
- self.assertTrue(
- barPersist.GetPointeeData().sint32[0] == 4,
+ self.assertEqual(
+ barPersist.GetPointeeData().sint32[0], 4,
"barPersist != 4")
self.assertEquals(bazPersist.GetSummary(), '"85"', "bazPersist != 85")
diff --git a/lldb/test/API/python_api/signals/TestSignalsAPI.py b/lldb/test/API/python_api/signals/TestSignalsAPI.py
index 602fee4..0f59016 100644
--- a/lldb/test/API/python_api/signals/TestSignalsAPI.py
+++ b/lldb/test/API/python_api/signals/TestSignalsAPI.py
@@ -48,9 +48,9 @@ class SignalsAPITestCase(TestBase):
unix_signals.SetShouldNotify(sigint, False)
process.Continue()
- self.assertTrue(
- process.state == lldb.eStateExited,
+ self.assertEqual(
+ process.state, lldb.eStateExited,
"The process should have exited")
- self.assertTrue(
- process.GetExitStatus() == 0,
+ self.assertEqual(
+ process.GetExitStatus(), 0,
"The process should have returned 0")
diff --git a/lldb/test/API/python_api/target/TestTargetAPI.py b/lldb/test/API/python_api/target/TestTargetAPI.py
index a8a10e4..7954f66 100644
--- a/lldb/test/API/python_api/target/TestTargetAPI.py
+++ b/lldb/test/API/python_api/target/TestTargetAPI.py
@@ -268,8 +268,8 @@ class TargetAPITestCase(TestBase):
value_list = m.FindGlobalVariables(
target, 'my_global_var_of_char_type', 3)
self.assertEqual(value_list.GetSize(), 1)
- self.assertTrue(
- value_list.GetValueAtIndex(0).GetValue() == "'X'")
+ self.assertEqual(
+ value_list.GetValueAtIndex(0).GetValue(), "'X'")
break
def find_compile_units(self, exe):
@@ -283,8 +283,8 @@ class TargetAPITestCase(TestBase):
list = target.FindCompileUnits(lldb.SBFileSpec(source_name, False))
# Executable has been built just from one source file 'main.c',
# so we may check only the first element of list.
- self.assertTrue(
- list[0].GetCompileUnit().GetFileSpec().GetFilename() == source_name)
+ self.assertEqual(
+ list[0].GetCompileUnit().GetFileSpec().GetFilename(), source_name)
def find_functions(self, exe_name):
"""Exercise SBTaget.FindFunctions() API."""
@@ -302,8 +302,8 @@ class TargetAPITestCase(TestBase):
self.assertEqual(list.GetSize(), 1)
for sc in list:
- self.assertTrue(
- sc.GetModule().GetFileSpec().GetFilename() == exe_name)
+ self.assertEqual(
+ sc.GetModule().GetFileSpec().GetFilename(), exe_name)
self.assertEqual(sc.GetSymbol().GetName(), 'c')
def get_description(self):
diff --git a/lldb/test/API/python_api/thread/TestThreadAPI.py b/lldb/test/API/python_api/thread/TestThreadAPI.py
index 420510a..a369c70 100644
--- a/lldb/test/API/python_api/thread/TestThreadAPI.py
+++ b/lldb/test/API/python_api/thread/TestThreadAPI.py
@@ -99,8 +99,7 @@ class ThreadAPITestCase(TestBase):
proc_of_thread = thread.GetProcess()
self.trace("proc_of_thread:", proc_of_thread)
- self.assertTrue(proc_of_thread.GetProcessID()
- == process.GetProcessID())
+ self.assertEqual(proc_of_thread.GetProcessID(), process.GetProcessID())
def get_stop_description(self):
"""Test Python SBThread.GetStopDescription() API."""
@@ -180,8 +179,8 @@ class ThreadAPITestCase(TestBase):
thread.StepOut()
self.runCmd("thread backtrace")
- self.assertTrue(
- thread.GetFrameAtIndex(0).GetLineEntry().GetLine() == self.step_out_of_malloc,
+ self.assertEqual(
+ thread.GetFrameAtIndex(0).GetLineEntry().GetLine(), self.step_out_of_malloc,
"step out of malloc into function b is successful")
def step_over_3_times(self, exe_name):
diff --git a/lldb/test/API/python_api/value/TestValueAPI.py b/lldb/test/API/python_api/value/TestValueAPI.py
index d6fff9b..b38eb2d 100644
--- a/lldb/test/API/python_api/value/TestValueAPI.py
+++ b/lldb/test/API/python_api/value/TestValueAPI.py
@@ -176,11 +176,11 @@ class ValueAPITestCase(TestBase):
]:
self.assertTrue(v)
- self.assertTrue(
- frame0.FindVariable('uinthex').GetValueAsUnsigned() == 3768803088,
+ self.assertEqual(
+ frame0.FindVariable('uinthex').GetValueAsUnsigned(), 3768803088,
'unsigned uinthex == 3768803088')
- self.assertTrue(
- frame0.FindVariable('sinthex').GetValueAsUnsigned() == 3768803088,
+ self.assertEqual(
+ frame0.FindVariable('sinthex').GetValueAsUnsigned(), 3768803088,
'unsigned sinthex == 3768803088')
self.assertTrue(
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 64391eb..b35c18a 100644
--- a/lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py
+++ b/lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py
@@ -82,8 +82,8 @@ class ChangeValueAPITestCase(TestBase):
self.assertTrue(result, "Setting val returned True.")
actual_value = val_value.GetValueAsSigned(error, 0)
self.assertTrue(error.Success(), "Got a changed value from val")
- self.assertTrue(
- actual_value == 12345,
+ self.assertEqual(
+ actual_value, 12345,
"Got the right changed value from val")
# Now check that we can set a structure element:
@@ -163,8 +163,8 @@ class ChangeValueAPITestCase(TestBase):
self.assertTrue(result, "Setting sp returned true.")
actual_value = sp_value.GetValueAsUnsigned(error, 0)
self.assertTrue(error.Success(), "Got a changed value for sp")
- self.assertTrue(
- actual_value == 1,
+ self.assertEqual(
+ actual_value, 1,
"Got the right changed value for sp.")
# Boundary condition test the SBValue.CreateValueFromExpression() API.
diff --git a/lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py b/lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py
index 9ac5d83..260956b 100644
--- a/lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py
+++ b/lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py
@@ -98,8 +98,8 @@ class SetWatchpointAPITestCase(TestBase):
process.Continue()
# At this point, the inferior process should have exited.
- self.assertTrue(
- process.GetState() == lldb.eStateExited,
+ self.assertEqual(
+ process.GetState(), lldb.eStateExited,
PROCESS_EXITED)
self.dbg.DeleteTarget(target)
diff --git a/lldb/test/API/python_api/watchpoint/TestWatchpointIter.py b/lldb/test/API/python_api/watchpoint/TestWatchpointIter.py
index 1a001f99..17ab024 100644
--- a/lldb/test/API/python_api/watchpoint/TestWatchpointIter.py
+++ b/lldb/test/API/python_api/watchpoint/TestWatchpointIter.py
@@ -113,8 +113,8 @@ class WatchpointIteratorTestCase(TestBase):
process.Continue()
# At this point, the inferior process should have exited.
- self.assertTrue(
- process.GetState() == lldb.eStateExited,
+ self.assertEqual(
+ process.GetState(), lldb.eStateExited,
PROCESS_EXITED)
# Verify some vital statistics and exercise the iterator API.