def test_extract(self):
for v in (True, False):
with TempDir() as tdir:
extract(simple_rar, tdir, verify_data=v)
h = {
normalize(os.path.abspath(os.path.join(tdir, h['filename']))): h
for h in headers(simple_rar)}
data = {}
for dirpath, dirnames, filenames in os.walk(tdir):
for f in filenames:
path = normalize(os.path.join(dirpath, f))
data[os.path.relpath(path, tdir).replace(os.sep, '/')] = d = open(path, 'rb').read()
if f == 'one.txt':
self.ae(os.path.getmtime(path), 1098472879)
self.ae(h[path]['unpack_size'], len(d))
self.ae(h[path]['file_crc'] & 0xffffffff, crc32(d) & 0xffffffff)
q = {k: v for k, v in sr_data.items() if v}
del q['symlink']
self.ae(data, q)
评论列表
文章目录