tools: binman: fix deprecated Python unittest methods

The methods `unittest.assertEquals()` and
`unittest.assertRegexpMatches()` are marked deprecated[1].

In Python 3.12 these aliases have been removed, so do a sed to replace
them with their new names.

[1] https://docs.python.org/3.11/library/unittest.html#deprecated-aliases

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
CC: Simon Glass <sjg@chromium.org>
CC: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/tools/binman/entry_test.py b/tools/binman/entry_test.py
index ac6582c..40d74d4 100644
--- a/tools/binman/entry_test.py
+++ b/tools/binman/entry_test.py
@@ -103,7 +103,7 @@
         ent = entry.Entry.Create(None, self.GetNode(), 'missing',
                                  missing_etype=True)
         self.assertTrue(isinstance(ent, Entry_blob))
-        self.assertEquals('missing', ent.etype)
+        self.assertEqual('missing', ent.etype)
 
     def testDecompressData(self):
         """Test the DecompressData() method of the base class"""
@@ -111,8 +111,8 @@
         base.compress = 'lz4'
         bintools = {}
         base.comp_bintool = base.AddBintool(bintools, '_testing')
-        self.assertEquals(tools.get_bytes(0, 1024), base.CompressData(b'abc'))
-        self.assertEquals(tools.get_bytes(0, 1024), base.DecompressData(b'abc'))
+        self.assertEqual(tools.get_bytes(0, 1024), base.CompressData(b'abc'))
+        self.assertEqual(tools.get_bytes(0, 1024), base.DecompressData(b'abc'))
 
     def testLookupOffset(self):
         """Test the lookup_offset() method of the base class"""
diff --git a/tools/binman/fdt_test.py b/tools/binman/fdt_test.py
index 7ef8729..564c177 100644
--- a/tools/binman/fdt_test.py
+++ b/tools/binman/fdt_test.py
@@ -44,43 +44,43 @@
         fname = self.GetCompiled('045_prop_test.dts')
         dt = FdtScan(fname)
         node = dt.GetNode('/binman/intel-me')
-        self.assertEquals('intel-me', node.name)
+        self.assertEqual('intel-me', node.name)
         val = fdt_util.GetString(node, 'filename')
-        self.assertEquals(str, type(val))
-        self.assertEquals('me.bin', val)
+        self.assertEqual(str, type(val))
+        self.assertEqual('me.bin', val)
 
         prop = node.props['intval']
-        self.assertEquals(fdt.Type.INT, prop.type)
-        self.assertEquals(3, fdt_util.GetInt(node, 'intval'))
+        self.assertEqual(fdt.Type.INT, prop.type)
+        self.assertEqual(3, fdt_util.GetInt(node, 'intval'))
 
         prop = node.props['intarray']
-        self.assertEquals(fdt.Type.INT, prop.type)
-        self.assertEquals(list, type(prop.value))
-        self.assertEquals(2, len(prop.value))
-        self.assertEquals([5, 6],
+        self.assertEqual(fdt.Type.INT, prop.type)
+        self.assertEqual(list, type(prop.value))
+        self.assertEqual(2, len(prop.value))
+        self.assertEqual([5, 6],
                           [fdt_util.fdt32_to_cpu(val) for val in prop.value])
 
         prop = node.props['byteval']
-        self.assertEquals(fdt.Type.BYTE, prop.type)
-        self.assertEquals(chr(8), prop.value)
+        self.assertEqual(fdt.Type.BYTE, prop.type)
+        self.assertEqual(chr(8), prop.value)
 
         prop = node.props['bytearray']
-        self.assertEquals(fdt.Type.BYTE, prop.type)
-        self.assertEquals(list, type(prop.value))
-        self.assertEquals(str, type(prop.value[0]))
-        self.assertEquals(3, len(prop.value))
-        self.assertEquals([chr(1), '#', '4'], prop.value)
+        self.assertEqual(fdt.Type.BYTE, prop.type)
+        self.assertEqual(list, type(prop.value))
+        self.assertEqual(str, type(prop.value[0]))
+        self.assertEqual(3, len(prop.value))
+        self.assertEqual([chr(1), '#', '4'], prop.value)
 
         prop = node.props['longbytearray']
-        self.assertEquals(fdt.Type.INT, prop.type)
-        self.assertEquals(0x090a0b0c, fdt_util.GetInt(node, 'longbytearray'))
+        self.assertEqual(fdt.Type.INT, prop.type)
+        self.assertEqual(0x090a0b0c, fdt_util.GetInt(node, 'longbytearray'))
 
         prop = node.props['stringval']
-        self.assertEquals(fdt.Type.STRING, prop.type)
-        self.assertEquals('message2', fdt_util.GetString(node, 'stringval'))
+        self.assertEqual(fdt.Type.STRING, prop.type)
+        self.assertEqual('message2', fdt_util.GetString(node, 'stringval'))
 
         prop = node.props['stringarray']
-        self.assertEquals(fdt.Type.STRING, prop.type)
-        self.assertEquals(list, type(prop.value))
-        self.assertEquals(3, len(prop.value))
-        self.assertEquals(['another', 'multi-word', 'message'], prop.value)
+        self.assertEqual(fdt.Type.STRING, prop.type)
+        self.assertEqual(list, type(prop.value))
+        self.assertEqual(3, len(prop.value))
+        self.assertEqual(['another', 'multi-word', 'message'], prop.value)
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 8a44bc0..567849b 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -2095,7 +2095,7 @@
         dtb.Scan()
         props = self._GetPropTree(dtb, ['size', 'uncomp-size'])
         orig = self._decompress(data)
-        self.assertEquals(COMPRESS_DATA, orig)
+        self.assertEqual(COMPRESS_DATA, orig)
 
         # Do a sanity check on various fields
         image = control.images['image']
@@ -2809,9 +2809,9 @@
 
         orig_entry = orig_image.GetEntries()['fdtmap']
         entry = image.GetEntries()['fdtmap']
-        self.assertEquals(orig_entry.offset, entry.offset)
-        self.assertEquals(orig_entry.size, entry.size)
-        self.assertEquals(orig_entry.image_pos, entry.image_pos)
+        self.assertEqual(orig_entry.offset, entry.offset)
+        self.assertEqual(orig_entry.size, entry.size)
+        self.assertEqual(orig_entry.image_pos, entry.image_pos)
 
     def testReadImageNoHeader(self):
         """Test accessing an image's FDT map without an image header"""
@@ -3895,7 +3895,7 @@
             mat = re_line.match(line)
             vals[mat.group(1)].append(mat.group(2))
 
-        self.assertEquals('FIT description: test-desc', lines[0])
+        self.assertEqual('FIT description: test-desc', lines[0])
         self.assertIn('Created:', lines[1])
         self.assertIn('Image 0 (kernel)', vals)
         self.assertIn('Hash value', vals)
@@ -4012,7 +4012,7 @@
             fit_pos,
             fdt_util.fdt32_to_cpu(fnode.props['data-position'].value))
 
-        self.assertEquals(expected_size, len(data))
+        self.assertEqual(expected_size, len(data))
         actual_pos = len(U_BOOT_DATA) + fit_pos
         self.assertEqual(U_BOOT_DATA + b'aa',
                          data[actual_pos:actual_pos + external_data_size])
@@ -4431,7 +4431,7 @@
         props = self._GetPropTree(dtb, ['offset', 'image-pos', 'size',
                                         'uncomp-size'])
         orig = self._decompress(data)
-        self.assertEquals(COMPRESS_DATA + U_BOOT_DATA, orig)
+        self.assertEqual(COMPRESS_DATA + U_BOOT_DATA, orig)
 
         # Do a sanity check on various fields
         image = control.images['image']
@@ -4475,7 +4475,7 @@
                                         'uncomp-size'])
         orig = self._decompress(data)
 
-        self.assertEquals(COMPRESS_DATA + COMPRESS_DATA + U_BOOT_DATA, orig)
+        self.assertEqual(COMPRESS_DATA + COMPRESS_DATA + U_BOOT_DATA, orig)
 
         # Do a sanity check on various fields
         image = control.images['image']
@@ -4519,7 +4519,7 @@
         props = self._GetPropTree(dtb, ['offset', 'image-pos', 'size',
                                         'uncomp-size'])
         orig = self._decompress(data)
-        self.assertEquals(COMPRESS_DATA + U_BOOT_DATA, orig)
+        self.assertEqual(COMPRESS_DATA + U_BOOT_DATA, orig)
         expected = {
             'section/blob:offset': 0,
             'section/blob:size': len(COMPRESS_DATA),
@@ -4545,7 +4545,7 @@
         props = self._GetPropTree(dtb, ['offset', 'image-pos', 'size',
                                         'uncomp-size'])
         orig = self._decompress(data)
-        self.assertEquals(COMPRESS_DATA + U_BOOT_DATA, orig)
+        self.assertEqual(COMPRESS_DATA + U_BOOT_DATA, orig)
         expected = {
             'section/blob:offset': 0,
             'section/blob:size': len(COMPRESS_DATA),
@@ -4580,7 +4580,7 @@
                                         'uncomp-size'])
 
         base = data[len(U_BOOT_DATA):]
-        self.assertEquals(U_BOOT_DATA, base[:len(U_BOOT_DATA)])
+        self.assertEqual(U_BOOT_DATA, base[:len(U_BOOT_DATA)])
         rest = base[len(U_BOOT_DATA):]
 
         # Check compressed data
@@ -4588,22 +4588,22 @@
         expect1 = bintool.compress(COMPRESS_DATA + U_BOOT_DATA)
         data1 = rest[:len(expect1)]
         section1 = self._decompress(data1)
-        self.assertEquals(expect1, data1)
-        self.assertEquals(COMPRESS_DATA + U_BOOT_DATA, section1)
+        self.assertEqual(expect1, data1)
+        self.assertEqual(COMPRESS_DATA + U_BOOT_DATA, section1)
         rest1 = rest[len(expect1):]
 
         expect2 = bintool.compress(COMPRESS_DATA + COMPRESS_DATA)
         data2 = rest1[:len(expect2)]
         section2 = self._decompress(data2)
-        self.assertEquals(expect2, data2)
-        self.assertEquals(COMPRESS_DATA + COMPRESS_DATA, section2)
+        self.assertEqual(expect2, data2)
+        self.assertEqual(COMPRESS_DATA + COMPRESS_DATA, section2)
         rest2 = rest1[len(expect2):]
 
         expect_size = (len(U_BOOT_DATA) + len(U_BOOT_DATA) + len(expect1) +
                        len(expect2) + len(U_BOOT_DATA))
-        #self.assertEquals(expect_size, len(data))
+        #self.assertEqual(expect_size, len(data))
 
-        #self.assertEquals(U_BOOT_DATA, rest2)
+        #self.assertEqual(U_BOOT_DATA, rest2)
 
         self.maxDiff = None
         expected = {
@@ -4695,7 +4695,7 @@
 
         u_boot = image.GetEntries()['section'].GetEntries()['u-boot']
 
-        self.assertEquals(U_BOOT_DATA, u_boot.ReadData())
+        self.assertEqual(U_BOOT_DATA, u_boot.ReadData())
 
     def testTplNoDtb(self):
         """Test that an image with tpl/u-boot-tpl-nodtb.bin can be created"""
@@ -5526,7 +5526,7 @@
         segments, entry = elf.read_loadable_segments(elf_data)
 
         # We assume there are two segments
-        self.assertEquals(2, len(segments))
+        self.assertEqual(2, len(segments))
 
         atf1 = dtb.GetNode('/images/atf-1')
         _, start, data = segments[0]
@@ -6107,7 +6107,7 @@
             data = bintool.compress(COMPRESS_DATA)
             self.assertNotEqual(COMPRESS_DATA, data)
             orig = bintool.decompress(data)
-            self.assertEquals(COMPRESS_DATA, orig)
+            self.assertEqual(COMPRESS_DATA, orig)
 
     def testCompUtilVersions(self):
         """Test tool version of compression algorithms"""
@@ -6125,7 +6125,7 @@
             self.assertNotEqual(COMPRESS_DATA, data)
             data += tools.get_bytes(0, 64)
             orig = bintool.decompress(data)
-            self.assertEquals(COMPRESS_DATA, orig)
+            self.assertEqual(COMPRESS_DATA, orig)
 
     def testCompressDtbZstd(self):
         """Test that zstd compress of device-tree files failed"""