comparison 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
comparison
equal deleted inserted replaced
220:ae6427d1c8f7 221:a2afbf236ca8
18 """) 18 """)
19 19
20 class test_import(common.basetest): 20 class test_import(common.basetest):
21 def test_basic_cstringio(self): 21 def test_basic_cstringio(self):
22 self.client.import_(BytesIO(patch)) 22 self.client.import_(BytesIO(patch))
23 self.assertEquals(self.client.cat([b('a')]), b('1\n')) 23 self.assertEqual(self.client.cat([b('a')]), b('1\n'))
24 24
25 def test_basic_file(self): 25 def test_basic_file(self):
26 f = open('patch', 'wb') 26 f = open('patch', 'wb')
27 f.write(patch) 27 f.write(patch)
28 f.close() 28 f.close()
29 29
30 # --no-commit 30 # --no-commit
31 self.client.import_([b('patch')], nocommit=True) 31 self.client.import_([b('patch')], nocommit=True)
32 self.assertEquals(open('a').read(), '1\n') 32 with open('a') as f:
33 self.assertEqual(f.read(), '1\n')
33 34
34 self.client.update(clean=True) 35 self.client.update(clean=True)
35 os.remove('a') 36 os.remove('a')
36 37
37 self.client.import_([b('patch')]) 38 self.client.import_([b('patch')])
38 self.assertEquals(self.client.cat([b('a')]), b('1\n')) 39 self.assertEqual(self.client.cat([b('a')]), b('1\n'))