def test_uncompress_file(self):
# Testing txt file type
self.assertRaisesRegexp(NotImplementedError,
"^Received .txt format. Only gz and bz2.*",
compression.uncompress_file,
**{'input_file_name': None,
'file_extension': '.txt',
'dest_dir': None
})
# Testing gz file type
fn_txt = self._get_fn('.txt')
fn_gz = self._get_fn('.gz')
txt_gz = compression.uncompress_file(fn_gz, '.gz', self.tmp_dir)
self.assertTrue(filecmp.cmp(txt_gz, fn_txt, shallow=False),
msg="Uncompressed file doest match original")
# Testing bz2 file type
fn_bz2 = self._get_fn('.bz2')
txt_bz2 = compression.uncompress_file(fn_bz2, '.bz2', self.tmp_dir)
self.assertTrue(filecmp.cmp(txt_bz2, fn_txt, shallow=False),
msg="Uncompressed file doest match original")
评论列表
文章目录