Mercurial > python-hglib
diff tests/test_context.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_context.py Thu Mar 09 11:33:04 2023 +0100 +++ b/tests/test_context.py Thu Mar 09 14:00:02 2023 +0100 @@ -21,44 +21,44 @@ ctx = self.client[node0] - self.assertEquals(ctx.description(), b('first')) - self.assertEquals(str(ctx), node0[:12].decode('latin-1')) - self.assertEquals(ctx.node(), node0) - self.assertEquals(int(ctx), rev0) - self.assertEquals(ctx.rev(), rev0) - self.assertEquals(ctx.branch(), b('default')) + self.assertEqual(ctx.description(), b('first')) + self.assertEqual(str(ctx), node0[:12].decode('latin-1')) + self.assertEqual(ctx.node(), node0) + self.assertEqual(int(ctx), rev0) + self.assertEqual(ctx.rev(), rev0) + self.assertEqual(ctx.branch(), b('default')) self.assertTrue(ctx) self.assertTrue(b('a') in ctx and b('b') in ctx) self.assertFalse(b('c') in ctx) - self.assertEquals(list(ctx), [b('a'), b('b')]) - self.assertEquals(ctx.files(), [b('a'), b('b')]) + self.assertEqual(list(ctx), [b('a'), b('b')]) + self.assertEqual(ctx.files(), [b('a'), b('b')]) - self.assertEquals(ctx.modified(), []) - self.assertEquals(ctx.added(), [b('a'), b('b')]) - self.assertEquals(ctx.removed(), []) - self.assertEquals(ctx.ignored(), []) - self.assertEquals(ctx.clean(), []) + self.assertEqual(ctx.modified(), []) + self.assertEqual(ctx.added(), [b('a'), b('b')]) + self.assertEqual(ctx.removed(), []) + self.assertEqual(ctx.ignored(), []) + self.assertEqual(ctx.clean(), []) man = {b('a') : b('047b75c6d7a3ef6a2243bd0e99f94f6ea6683597'), b('b') : b('62452855512f5b81522aa3895892760bb8da9f3f')} - self.assertEquals(ctx.manifest(), man) + self.assertEqual(ctx.manifest(), man) - self.assertEquals([int(c) for c in ctx.parents()], [-1]) - self.assertEquals(int(ctx.p1()), -1) - self.assertEquals(int(ctx.p2()), -1) + self.assertEqual([int(c) for c in ctx.parents()], [-1]) + self.assertEqual(int(ctx.p1()), -1) + self.assertEqual(int(ctx.p2()), -1) - self.assertEquals([int(c) for c in ctx.children()], [1]) - self.assertEquals([int(c) for c in ctx.descendants()], [0, 1]) - self.assertEquals([int(c) for c in ctx.ancestors()], [0]) + self.assertEqual([int(c) for c in ctx.children()], [1]) + self.assertEqual([int(c) for c in ctx.descendants()], [0, 1]) + self.assertEqual([int(c) for c in ctx.ancestors()], [0]) self.client.bookmark(b('bookmark'), inactive=True, rev=node0) - self.assertEquals(ctx.bookmarks(), [b('bookmark')]) + self.assertEqual(ctx.bookmarks(), [b('bookmark')]) self.client.tag(b('tag'), rev=node0) # tags are read on construction - self.assertEquals(self.client[node0].tags(), [b('tag')]) + self.assertEqual(self.client[node0].tags(), [b('tag')]) def test_construction(self): self.append('a', 'a') @@ -67,11 +67,11 @@ # from client.revision ctx = context.changectx(self.client, tip) - self.assertEquals(ctx.node(), tip.node) + self.assertEqual(ctx.node(), tip.node) # from revset ctx = context.changectx(self.client, b('all()')) - self.assertEquals(ctx.node(), tip.node) + self.assertEqual(ctx.node(), tip.node) def test_in_keyword(self): """