summaryrefslogtreecommitdiff
path: root/lldb/test/API/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
diff options
context:
space:
mode:
authorJordan Rupprecht <rupprecht@google.com>2024-02-21 13:02:30 -0600
committerGitHub <noreply@github.com>2024-02-21 13:02:30 -0600
commit9c2468821ec51defd09c246fea4a47886fff8c01 (patch)
tree37781dd1ecd1e72faad5215f06e5a1579106b451 /lldb/test/API/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
parent4247175d4536964322b129d1d3bbe6128da653bf (diff)
[lldb][test] Modernize asserts (#82503)
This uses [teyit](https://pypi.org/project/teyit/) to modernize asserts, as recommended by the [unittest release notes](https://docs.python.org/3.12/whatsnew/3.12.html#id3). For example, `assertTrue(a == b)` is replaced with `assertEqual(a, b)`. This produces better error messages, e.g. `error: unexpectedly found 1 and 2 to be different` instead of `error: False`.
Diffstat (limited to 'lldb/test/API/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py')
-rw-r--r--lldb/test/API/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py b/lldb/test/API/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
index cae1e3b498b0..512840b9f065 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
@@ -315,11 +315,13 @@ class PythonSynthDataFormatterTestCase(TestBase):
if self.TraceOn():
print(str_cast)
- self.assertTrue(str_cast.find("A") != -1, "could not find A in output")
- self.assertTrue(str_cast.find("B") != -1, "could not find B in output")
- self.assertTrue(str_cast.find("C") != -1, "could not find C in output")
- self.assertTrue(str_cast.find("D") != -1, "could not find D in output")
- self.assertTrue(str_cast.find("4 = '\\0'") != -1, "could not find item 4 == 0")
+ self.assertNotEqual(str_cast.find("A"), -1, "could not find A in output")
+ self.assertNotEqual(str_cast.find("B"), -1, "could not find B in output")
+ self.assertNotEqual(str_cast.find("C"), -1, "could not find C in output")
+ self.assertNotEqual(str_cast.find("D"), -1, "could not find D in output")
+ self.assertNotEqual(
+ str_cast.find("4 = '\\0'"), -1, "could not find item 4 == 0"
+ )
self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().StepOver()
@@ -331,8 +333,10 @@ class PythonSynthDataFormatterTestCase(TestBase):
# we detect that all the values of the child objects have changed - but the counter-generated item
# is still fixed at 0 because it is cached - this would fail if update(self): in ftsp returned False
# or if synthetic children were not being preserved
- self.assertTrue(str_cast.find("Q") != -1, "could not find Q in output")
- self.assertTrue(str_cast.find("X") != -1, "could not find X in output")
- self.assertTrue(str_cast.find("T") != -1, "could not find T in output")
- self.assertTrue(str_cast.find("F") != -1, "could not find F in output")
- self.assertTrue(str_cast.find("4 = '\\0'") != -1, "could not find item 4 == 0")
+ self.assertNotEqual(str_cast.find("Q"), -1, "could not find Q in output")
+ self.assertNotEqual(str_cast.find("X"), -1, "could not find X in output")
+ self.assertNotEqual(str_cast.find("T"), -1, "could not find T in output")
+ self.assertNotEqual(str_cast.find("F"), -1, "could not find F in output")
+ self.assertNotEqual(
+ str_cast.find("4 = '\\0'"), -1, "could not find item 4 == 0"
+ )