Mercurial > python-hglib
diff tests/test_import.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 | 484b56ac4aec |
line wrap: on
line diff
--- a/tests/test_import.py Thu Mar 09 11:33:04 2023 +0100 +++ b/tests/test_import.py Thu Mar 09 14:00:02 2023 +0100 @@ -20,7 +20,7 @@ class test_import(common.basetest): def test_basic_cstringio(self): self.client.import_(BytesIO(patch)) - self.assertEquals(self.client.cat([b('a')]), b('1\n')) + self.assertEqual(self.client.cat([b('a')]), b('1\n')) def test_basic_file(self): f = open('patch', 'wb') @@ -29,10 +29,11 @@ # --no-commit self.client.import_([b('patch')], nocommit=True) - self.assertEquals(open('a').read(), '1\n') + with open('a') as f: + self.assertEqual(f.read(), '1\n') self.client.update(clean=True) os.remove('a') self.client.import_([b('patch')]) - self.assertEquals(self.client.cat([b('a')]), b('1\n')) + self.assertEqual(self.client.cat([b('a')]), b('1\n'))