comparison tests/test_import.py @ 227:484b56ac4aec default tip

hglib: cat accepts a template argument
author Julien Cristau <jcristau@mozilla.com>
date Mon, 17 Jun 2024 17:17:58 +0200
parents a2afbf236ca8
children
comparison
equal deleted inserted replaced
226:7b6ea46ea111 227:484b56ac4aec
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.assertEqual(self.client.cat([b('a')]), b('1\n')) 23 self.assertEqual(self.client.cat([b('a')]), b('1\n'))
24 self.assertEqual(self.client.cat([b('a')], template=b'{path}\\0{data}'), b('a\x001\n'))
24 25
25 def test_basic_file(self): 26 def test_basic_file(self):
26 f = open('patch', 'wb') 27 f = open('patch', 'wb')
27 f.write(patch) 28 f.write(patch)
28 f.close() 29 f.close()
35 self.client.update(clean=True) 36 self.client.update(clean=True)
36 os.remove('a') 37 os.remove('a')
37 38
38 self.client.import_([b('patch')]) 39 self.client.import_([b('patch')])
39 self.assertEqual(self.client.cat([b('a')]), b('1\n')) 40 self.assertEqual(self.client.cat([b('a')]), b('1\n'))
41 self.assertEqual(self.client.cat([b('a')], template=b'{path}\\0{data}'), b('a\x001\n'))