def test_decompress_file(self):
path = self.root.make_file()
gzfile = path + '.gz'
with gzip.open(gzfile, 'wt') as o:
o.write('foo')
path2 = decompress_file(gzfile, keep=True)
self.assertEqual(path, path2)
self.assertTrue(os.path.exists(gzfile))
self.assertTrue(os.path.exists(path))
with open(path, 'rt') as i:
self.assertEqual(i.read(), 'foo')
with open(gzfile, 'rb') as i:
path2 = decompress_file(i, keep=True)
self.assertEqual(path, path2)
self.assertTrue(os.path.exists(gzfile))
self.assertTrue(os.path.exists(path))
with open(path, 'rt') as i:
self.assertEqual(i.read(), 'foo')
评论列表
文章目录