diff tests/test_commit.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_commit.py	Thu Mar 09 11:33:04 2023 +0100
+++ b/tests/test_commit.py	Thu Mar 09 14:00:02 2023 +0100
@@ -8,7 +8,7 @@
         rev, node = self.client.commit(b('first'), addremove=True,
                                        user=b('foo'))
         rev = self.client.log(node)[0]
-        self.assertEquals(rev.author, b('foo'))
+        self.assertEqual(rev.author, b('foo'))
 
     def test_no_user(self):
         self.append('a', 'a')
@@ -24,10 +24,10 @@
         revclose = self.client.commit(b('closing foo'), closebranch=True)
         rev0, rev1, revclose = self.client.log([node0, node1, revclose[1]])
 
-        self.assertEquals(self.client.branches(),
+        self.assertEqual(self.client.branches(),
                           [(rev0.branch, int(rev0.rev), rev0.node[:12])])
 
-        self.assertEquals(self.client.branches(closed=True),
+        self.assertEqual(self.client.branches(closed=True),
                           [(revclose.branch, int(revclose.rev),
                             revclose.node[:12]),
                            (rev0.branch, int(rev0.rev), rev0.node[:12])])
@@ -44,7 +44,7 @@
             b('first'), addremove=True,
             date=now.isoformat(' ').encode('latin-1'))
 
-        self.assertEquals(now, self.client.tip().date)
+        self.assertEqual(now, self.client.tip().date)
 
     def test_amend(self):
         self.append('a', 'a')
@@ -53,12 +53,12 @@
             b('first'), addremove=True,
             date=now.isoformat(' ').encode('latin-1'))
 
-        self.assertEquals(now, self.client.tip().date)
+        self.assertEqual(now, self.client.tip().date)
 
         self.append('a', 'a')
         rev1, node1 = self.client.commit(amend=True)
-        self.assertEquals(now, self.client.tip().date)
-        self.assertNotEquals(node0, node1)
+        self.assertEqual(now, self.client.tip().date)
+        self.assertNotEqual(node0, node1)
         self.assertEqual(1, len(self.client.log()))
 
     def test_nul_injection(self):