diff tests/test_grep.py @ 221:a2afbf236ca8

hglib tests: remove deprecated constructions This mostly removes usage of 'assertEquals' (replaced with 'assertEqual'), as well as opening files without closing them (fixed using a 'with' statement).
author Mathias De Mare <mathias.de_mare@nokia.com>
date Thu, 09 Mar 2023 14:00:02 +0100
parents 8341f2494b3f
children
line wrap: on
line diff
--- a/tests/test_grep.py	Thu Mar 09 11:33:04 2023 +0100
+++ b/tests/test_grep.py	Thu Mar 09 14:00:02 2023 +0100
@@ -8,22 +8,22 @@
         self.client.commit(b('first'), addremove=True)
 
         # no match
-        self.assertEquals(list(self.client.grep(b('c'))), [])
+        self.assertEqual(list(self.client.grep(b('c'))), [])
 
         if self.client.version >= (5, 2):
-            self.assertEquals(list(self.client.grep(b('x'))),
+            self.assertEqual(list(self.client.grep(b('x'))),
                               [(b('a'), b('x')), (b('b'), b('xy'))])
-            self.assertEquals(list(self.client.grep(b('x'), b('a'))),
+            self.assertEqual(list(self.client.grep(b('x'), b('a'))),
                               [(b('a'), b('x'))])
 
-            self.assertEquals(list(self.client.grep(b('y'))),
+            self.assertEqual(list(self.client.grep(b('y'))),
                               [(b('b'), b('xy'))])
         else:
-            self.assertEquals(list(self.client.grep(b('x'))),
+            self.assertEqual(list(self.client.grep(b('x'))),
                               [(b('a'), b('0'), b('x')), (b('b'), b('0'), b('xy'))])
-            self.assertEquals(list(self.client.grep(b('x'), b('a'))),
+            self.assertEqual(list(self.client.grep(b('x'), b('a'))),
                               [(b('a'), b('0'), b('x'))])
-            self.assertEquals(list(self.client.grep(b('y'))),
+            self.assertEqual(list(self.client.grep(b('y'))),
                               [(b('b'), b('0'), b('xy'))])
 
     def test_options(self):
@@ -31,33 +31,33 @@
         self.append('b', 'xy\n')
         rev, node = self.client.commit(b('first'), addremove=True)
 
-        self.assertEquals([(b('a'), b('0'), b('+'), b('x')),
+        self.assertEqual([(b('a'), b('0'), b('+'), b('x')),
                            (b('b'), b('0'), b('+'), b('xy'))],
                           list(self.client.grep(b('x'), all=True)))
 
         if self.client.version >= (5, 2):
-            self.assertEquals([(b('a'),), (b('b'),)],
+            self.assertEqual([(b('a'),), (b('b'),)],
                               list(self.client.grep(b('x'), fileswithmatches=True)))
 
-            self.assertEquals([(b('a'), b('1'), b('x')), (b('b'), b('1'), b('xy'))],
+            self.assertEqual([(b('a'), b('1'), b('x')), (b('b'), b('1'), b('xy'))],
                               list(self.client.grep(b('x'), line=True)))
 
-            self.assertEquals([(b('a'), b('test'), b('x')),
+            self.assertEqual([(b('a'), b('test'), b('x')),
                                (b('b'), b('test'), b('xy'))],
                               list(self.client.grep(b('x'), user=True)))
         else:
-            self.assertEquals([(b('a'), b('0')), (b('b'), b('0'))],
+            self.assertEqual([(b('a'), b('0')), (b('b'), b('0'))],
                               list(self.client.grep(b('x'), fileswithmatches=True)))
 
-            self.assertEquals([(b('a'), b('0'), b('1'), b('x')),
+            self.assertEqual([(b('a'), b('0'), b('1'), b('x')),
                                (b('b'), b('0'), b('1'), b('xy'))],
                               list(self.client.grep(b('x'), line=True)))
 
-            self.assertEquals([(b('a'), b('0'), b('test'), b('x')),
+            self.assertEqual([(b('a'), b('0'), b('test'), b('x')),
                                (b('b'), b('0'), b('test'), b('xy'))],
                               list(self.client.grep(b('x'), user=True)))
 
-        self.assertEquals([(b('a'), b('0'), b('1'), b('+'), b('test')),
+        self.assertEqual([(b('a'), b('0'), b('1'), b('+'), b('test')),
                            (b('b'), b('0'), b('1'), b('+'), b('test'))],
                           list(self.client.grep(b('x'), all=True, user=True,
                                                 line=True,