[Lldb-commits] [lldb] a4ad052 - [lldb-dap] Replace `assertEquals` with `assertEqual` (NFC)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri May 17 10:12:57 PDT 2024


Author: Jonas Devlieghere
Date: 2024-05-17T10:12:51-07:00
New Revision: a4ad05284e97dd188c44252846486cbfb74a884c

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

LOG: [lldb-dap] Replace `assertEquals` with `assertEqual` (NFC)

Fixes new test that were added or modified after #82073. Also fixes a
formatting issue.

Added: 
    

Modified: 
    lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py
    lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py b/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py
index 52c0bbfb33dad..1e0e40d4a0130 100644
--- a/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py
+++ b/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py
@@ -27,10 +27,10 @@ def test_duplicate_start_addresses(self):
         response_x = self.dap_server.request_dataBreakpointInfo(0, "&x")
         response_arr_2 = self.dap_server.request_dataBreakpointInfo(0, "arr+2")
         # Test response from dataBreakpointInfo request.
-        self.assertEquals(response_x["body"]["dataId"].split("/")[1], "4")
-        self.assertEquals(response_x["body"]["accessTypes"], self.accessTypes)
-        self.assertEquals(response_arr_2["body"]["dataId"].split("/")[1], "4")
-        self.assertEquals(response_arr_2["body"]["accessTypes"], self.accessTypes)
+        self.assertEqual(response_x["body"]["dataId"].split("/")[1], "4")
+        self.assertEqual(response_x["body"]["accessTypes"], self.accessTypes)
+        self.assertEqual(response_arr_2["body"]["dataId"].split("/")[1], "4")
+        self.assertEqual(response_arr_2["body"]["accessTypes"], self.accessTypes)
         # The first one should be overwritten by the third one as they start at
         # the same address. This is indicated by returning {verified: False} for
         # the first one.
@@ -40,7 +40,7 @@ def test_duplicate_start_addresses(self):
             {"dataId": response_x["body"]["dataId"], "accessType": "write"},
         ]
         set_response = self.dap_server.request_setDataBreakpoint(dataBreakpoints)
-        self.assertEquals(
+        self.assertEqual(
             set_response["body"]["breakpoints"],
             [{"verified": False}, {"verified": True}, {"verified": True}],
         )
@@ -48,14 +48,14 @@ def test_duplicate_start_addresses(self):
         self.continue_to_next_stop()
         x_val = self.dap_server.get_local_variable_value("x")
         i_val = self.dap_server.get_local_variable_value("i")
-        self.assertEquals(x_val, "2")
-        self.assertEquals(i_val, "1")
+        self.assertEqual(x_val, "2")
+        self.assertEqual(i_val, "1")
 
         self.continue_to_next_stop()
         arr_2 = self.dap_server.get_local_variable_child("arr", "[2]")
         i_val = self.dap_server.get_local_variable_value("i")
-        self.assertEquals(arr_2["value"], "42")
-        self.assertEquals(i_val, "2")
+        self.assertEqual(arr_2["value"], "42")
+        self.assertEqual(i_val, "2")
 
     @skipIfWindows
     @skipIfRemote
@@ -72,16 +72,16 @@ def test_expression(self):
         response_x = self.dap_server.request_dataBreakpointInfo(0, "&x")
         response_arr_2 = self.dap_server.request_dataBreakpointInfo(0, "arr+2")
         # Test response from dataBreakpointInfo request.
-        self.assertEquals(response_x["body"]["dataId"].split("/")[1], "4")
-        self.assertEquals(response_x["body"]["accessTypes"], self.accessTypes)
-        self.assertEquals(response_arr_2["body"]["dataId"].split("/")[1], "4")
-        self.assertEquals(response_arr_2["body"]["accessTypes"], self.accessTypes)
+        self.assertEqual(response_x["body"]["dataId"].split("/")[1], "4")
+        self.assertEqual(response_x["body"]["accessTypes"], self.accessTypes)
+        self.assertEqual(response_arr_2["body"]["dataId"].split("/")[1], "4")
+        self.assertEqual(response_arr_2["body"]["accessTypes"], self.accessTypes)
         dataBreakpoints = [
             {"dataId": response_x["body"]["dataId"], "accessType": "write"},
             {"dataId": response_arr_2["body"]["dataId"], "accessType": "write"},
         ]
         set_response = self.dap_server.request_setDataBreakpoint(dataBreakpoints)
-        self.assertEquals(
+        self.assertEqual(
             set_response["body"]["breakpoints"],
             [{"verified": True}, {"verified": True}],
         )
@@ -89,14 +89,14 @@ def test_expression(self):
         self.continue_to_next_stop()
         x_val = self.dap_server.get_local_variable_value("x")
         i_val = self.dap_server.get_local_variable_value("i")
-        self.assertEquals(x_val, "2")
-        self.assertEquals(i_val, "1")
+        self.assertEqual(x_val, "2")
+        self.assertEqual(i_val, "1")
 
         self.continue_to_next_stop()
         arr_2 = self.dap_server.get_local_variable_child("arr", "[2]")
         i_val = self.dap_server.get_local_variable_value("i")
-        self.assertEquals(arr_2["value"], "42")
-        self.assertEquals(i_val, "2")
+        self.assertEqual(arr_2["value"], "42")
+        self.assertEqual(i_val, "2")
 
     @skipIfWindows
     @skipIfRemote
@@ -117,16 +117,16 @@ def test_functionality(self):
         )
 
         # Test response from dataBreakpointInfo request.
-        self.assertEquals(response_x["body"]["dataId"].split("/")[1], "4")
-        self.assertEquals(response_x["body"]["accessTypes"], self.accessTypes)
-        self.assertEquals(response_arr_2["body"]["dataId"].split("/")[1], "4")
-        self.assertEquals(response_arr_2["body"]["accessTypes"], self.accessTypes)
+        self.assertEqual(response_x["body"]["dataId"].split("/")[1], "4")
+        self.assertEqual(response_x["body"]["accessTypes"], self.accessTypes)
+        self.assertEqual(response_arr_2["body"]["dataId"].split("/")[1], "4")
+        self.assertEqual(response_arr_2["body"]["accessTypes"], self.accessTypes)
         dataBreakpoints = [
             {"dataId": response_x["body"]["dataId"], "accessType": "write"},
             {"dataId": response_arr_2["body"]["dataId"], "accessType": "write"},
         ]
         set_response = self.dap_server.request_setDataBreakpoint(dataBreakpoints)
-        self.assertEquals(
+        self.assertEqual(
             set_response["body"]["breakpoints"],
             [{"verified": True}, {"verified": True}],
         )
@@ -134,14 +134,14 @@ def test_functionality(self):
         self.continue_to_next_stop()
         x_val = self.dap_server.get_local_variable_value("x")
         i_val = self.dap_server.get_local_variable_value("i")
-        self.assertEquals(x_val, "2")
-        self.assertEquals(i_val, "1")
+        self.assertEqual(x_val, "2")
+        self.assertEqual(i_val, "1")
 
         self.continue_to_next_stop()
         arr_2 = self.dap_server.get_local_variable_child("arr", "[2]")
         i_val = self.dap_server.get_local_variable_value("i")
-        self.assertEquals(arr_2["value"], "42")
-        self.assertEquals(i_val, "2")
+        self.assertEqual(arr_2["value"], "42")
+        self.assertEqual(i_val, "2")
         self.dap_server.request_setDataBreakpoint([])
 
         # Test hit condition
@@ -156,10 +156,10 @@ def test_functionality(self):
             }
         ]
         set_response = self.dap_server.request_setDataBreakpoint(dataBreakpoints)
-        self.assertEquals(set_response["body"]["breakpoints"], [{"verified": True}])
+        self.assertEqual(set_response["body"]["breakpoints"], [{"verified": True}])
         self.continue_to_next_stop()
         x_val = self.dap_server.get_local_variable_value("x")
-        self.assertEquals(x_val, "3")
+        self.assertEqual(x_val, "3")
 
         # Test condition
         dataBreakpoints = [
@@ -170,7 +170,7 @@ def test_functionality(self):
             }
         ]
         set_response = self.dap_server.request_setDataBreakpoint(dataBreakpoints)
-        self.assertEquals(set_response["body"]["breakpoints"], [{"verified": True}])
+        self.assertEqual(set_response["body"]["breakpoints"], [{"verified": True}])
         self.continue_to_next_stop()
         x_val = self.dap_server.get_local_variable_value("x")
-        self.assertEquals(x_val, "10")
+        self.assertEqual(x_val, "10")

diff  --git a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
index ab7dfb5216ae1..07ab6d5a63eb6 100644
--- a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
+++ b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
@@ -254,18 +254,22 @@ def do_test_scopes_variables_setVariable_evaluate(
             "pt": {
                 "equals": {"type": "PointType"},
                 "startswith": {
-                    "result": "{x:11, y:22, buffer:{...}}"
-                    if enableAutoVariableSummaries
-                    else "PointType @ 0x"
+                    "result": (
+                        "{x:11, y:22, buffer:{...}}"
+                        if enableAutoVariableSummaries
+                        else "PointType @ 0x"
+                    )
                 },
                 "hasVariablesReference": True,
             },
             "pt.buffer": {
                 "equals": {"type": "int[16]"},
                 "startswith": {
-                    "result": "{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...}"
-                    if enableAutoVariableSummaries
-                    else "int[16] @ 0x"
+                    "result": (
+                        "{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...}"
+                        if enableAutoVariableSummaries
+                        else "int[16] @ 0x"
+                    )
                 },
                 "hasVariablesReference": True,
             },
@@ -528,9 +532,11 @@ def do_test_scopes_and_evaluate_expansion(self, enableAutoVariableSummaries: boo
                 "watch": {
                     "equals": {"type": "PointType"},
                     "startswith": {
-                        "result": "{x:11, y:22, buffer:{...}}"
-                        if enableAutoVariableSummaries
-                        else "PointType @ 0x"
+                        "result": (
+                            "{x:11, y:22, buffer:{...}}"
+                            if enableAutoVariableSummaries
+                            else "PointType @ 0x"
+                        )
                     },
                     "missing": ["indexedVariables"],
                     "hasVariablesReference": True,
@@ -538,9 +544,11 @@ def do_test_scopes_and_evaluate_expansion(self, enableAutoVariableSummaries: boo
                 "variables": {
                     "equals": {"type": "PointType"},
                     "startswith": {
-                        "result": "{x:11, y:22, buffer:{...}}"
-                        if enableAutoVariableSummaries
-                        else "PointType @ 0x"
+                        "result": (
+                            "{x:11, y:22, buffer:{...}}"
+                            if enableAutoVariableSummaries
+                            else "PointType @ 0x"
+                        )
                     },
                     "missing": ["indexedVariables"],
                     "hasVariablesReference": True,
@@ -777,20 +785,20 @@ def test_value_format(self):
         # Verify locals value format decimal
         is_hex = False
         var_pt_x = self.dap_server.get_local_variable_child("pt", "x", is_hex=is_hex)
-        self.assertEquals(var_pt_x["value"], "11")
+        self.assertEqual(var_pt_x["value"], "11")
         var_pt_y = self.dap_server.get_local_variable_child("pt", "y", is_hex=is_hex)
-        self.assertEquals(var_pt_y["value"], "22")
+        self.assertEqual(var_pt_y["value"], "22")
 
         # Verify locals value format hexical
         is_hex = True
         var_pt_x = self.dap_server.get_local_variable_child("pt", "x", is_hex=is_hex)
-        self.assertEquals(var_pt_x["value"], "0x0000000b")
+        self.assertEqual(var_pt_x["value"], "0x0000000b")
         var_pt_y = self.dap_server.get_local_variable_child("pt", "y", is_hex=is_hex)
-        self.assertEquals(var_pt_y["value"], "0x00000016")
+        self.assertEqual(var_pt_y["value"], "0x00000016")
 
         # Toggle and verify locals value format decimal again
         is_hex = False
         var_pt_x = self.dap_server.get_local_variable_child("pt", "x", is_hex=is_hex)
-        self.assertEquals(var_pt_x["value"], "11")
+        self.assertEqual(var_pt_x["value"], "11")
         var_pt_y = self.dap_server.get_local_variable_child("pt", "y", is_hex=is_hex)
-        self.assertEquals(var_pt_y["value"], "22")
+        self.assertEqual(var_pt_y["value"], "22")


        


More information about the lldb-commits mailing list