mirror of
https://github.com/Unstructured-IO/unstructured.git
synced 2025-07-09 10:05:56 +00:00
16 lines
448 B
Python
16 lines
448 B
Python
![]() |
import os
|
||
|
import tarfile
|
||
|
|
||
|
from unstructured.ingest.utils.compression import uncompress_tar_file
|
||
|
|
||
|
|
||
|
def test_uncompress_tar_file(tmpdir):
|
||
|
tar_filename = os.path.join(tmpdir, "test.tar")
|
||
|
filename = "example-docs/fake-text.txt"
|
||
|
|
||
|
with tarfile.open(tar_filename, "w:gz") as tar:
|
||
|
tar.add(filename, arcname=os.path.basename(filename))
|
||
|
|
||
|
path = uncompress_tar_file(tar_filename, path=tmpdir.dirname)
|
||
|
assert path == tmpdir.dirname
|