Skip to content

Commit

Permalink
add extractor test
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderVNikitin committed Feb 27, 2024
1 parent 513d9d6 commit 0af93c2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest

import os
import tarfile
import shutil
import uuid
import functools
Expand Down Expand Up @@ -334,4 +335,15 @@ def test_get_covid_19():
assert X.shape[0] == len(states)
assert len(X.shape) == 3
assert X.shape[2] == 4
assert X.shape[1] >= 150
assert X.shape[1] >= 150


def test_extract_targz():
resource_folder = "./tmp/test_download/"
os.makedirs(resource_folder, exist_ok=True)
output_filename = "./tmp/dir.gz"
extracted_path = "./tmp/extracted"
with tarfile.open(output_filename, "w:gz") as tar:
tar.add(resource_folder, arcname=os.path.basename(resource_folder))
tsgm.utils.file_utils._extract_targz(output_filename, extracted_path)
assert os.path.isdir(extracted_path)

0 comments on commit 0af93c2

Please sign in to comment.