Mercurial > hg
diff tests/test-remotefilelog-datapack.py @ 41321:724b4606528e
tests: use assertEqual()
This avoids a deprecation warning under at least Python 3.7.
Differential Revision: https://phab.mercurial-scm.org/D5653
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 22 Jan 2019 18:16:53 -0800 |
parents | 878084a495ef |
children | 268325697a47 |
line wrap: on
line diff
--- a/tests/test-remotefilelog-datapack.py Tue Jan 22 18:11:34 2019 -0800 +++ b/tests/test-remotefilelog-datapack.py Tue Jan 22 18:16:53 2019 -0800 @@ -79,11 +79,11 @@ revisions = [(filename, node, nullid, content)] pack = self.createPack(revisions) if self.paramsavailable: - self.assertEquals(pack.params.fanoutprefix, - basepack.SMALLFANOUTPREFIX) + self.assertEqual(pack.params.fanoutprefix, + basepack.SMALLFANOUTPREFIX) chain = pack.getdeltachain(filename, node) - self.assertEquals(content, chain[0][4]) + self.assertEqual(content, chain[0][4]) def testAddSingle(self): self._testAddSingle('') @@ -106,10 +106,10 @@ for filename, node, base, content in revisions: entry = pack.getdelta(filename, node) - self.assertEquals((content, filename, base, {}), entry) + self.assertEqual((content, filename, base, {}), entry) chain = pack.getdeltachain(filename, node) - self.assertEquals(content, chain[0][4]) + self.assertEqual(content, chain[0][4]) def testAddDeltas(self): """Test putting multiple delta blobs into a pack and read the chain. @@ -127,13 +127,13 @@ entry = pack.getdelta(filename, revisions[0][1]) realvalue = (revisions[0][3], filename, revisions[0][2], {}) - self.assertEquals(entry, realvalue) + self.assertEqual(entry, realvalue) # Test that the chain for the final entry has all the others chain = pack.getdeltachain(filename, node) for i in range(10): content = "abcdef%s" % i - self.assertEquals(content, chain[-i - 1][4]) + self.assertEqual(content, chain[-i - 1][4]) def testPackMany(self): """Pack many related and unrelated objects. @@ -162,7 +162,7 @@ chain = pack.getdeltachain(filename, node) for entry in chain: expectedcontent = blobs[(entry[0], entry[1], entry[3])] - self.assertEquals(entry[4], expectedcontent) + self.assertEqual(entry[4], expectedcontent) def testPackMetadata(self): revisions = [] @@ -181,7 +181,7 @@ # flag == 0 should be optimized out if origmeta[constants.METAKEYFLAG] == 0: del origmeta[constants.METAKEYFLAG] - self.assertEquals(parsedmeta, origmeta) + self.assertEqual(parsedmeta, origmeta) def testGetMissing(self): """Test the getmissing() api. @@ -206,7 +206,7 @@ fakenode = self.getFakeHash() missing = pack.getmissing([("foo", revisions[0][1]), ("foo", fakenode)]) - self.assertEquals(missing, [("foo", fakenode)]) + self.assertEqual(missing, [("foo", fakenode)]) def testAddThrows(self): pack = self.createPack() @@ -238,7 +238,7 @@ revisions = [("filename", fakenode, self.getFakeHash(), "content")] pack = self.createPack(revisions) chain = pack.getdeltachain("filename", fakenode) - self.assertEquals(len(chain), 1) + self.assertEqual(len(chain), 1) def testLargePack(self): """Test creating and reading from a large pack with over X entries. @@ -255,12 +255,12 @@ pack = self.createPack(revisions) if self.paramsavailable: - self.assertEquals(pack.params.fanoutprefix, - basepack.LARGEFANOUTPREFIX) + self.assertEqual(pack.params.fanoutprefix, + basepack.LARGEFANOUTPREFIX) for (filename, node), content in blobs.iteritems(): actualcontent = pack.getdeltachain(filename, node)[0][4] - self.assertEquals(actualcontent, content) + self.assertEqual(actualcontent, content) def testPacksCache(self): """Test that we remember the most recent packs while fetching the delta @@ -300,12 +300,12 @@ chain = store.getdeltachain(revision[0], revision[1]) mostrecentpack = next(iter(store.packs), None) - self.assertEquals( + self.assertEqual( mostrecentpack.getdeltachain(revision[0], revision[1]), chain ) - self.assertEquals(randomchain.index(revision) + 1, len(chain)) + self.assertEqual(randomchain.index(revision) + 1, len(chain)) # perf test off by default since it's slow def _testIndexPerf(self):