test_utils.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:xphyle 作者: jdidion 项目源码 文件源码
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')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号