skyeweave/tests/test_02_download.py

67 lines
2 KiB
Python
Raw Normal View History

2024-10-20 19:38:22 +00:00
from pathlib import Path
from skyeweave import SkyeWeave
def test_servantid_download(path_images: Path, path_output: Path):
test_id = 70
test_weaver = SkyeWeave(
test_id,
output=path_output,
assets=path_images
)
test_weaver.download()
expected_path = path_images / str(test_id)
expected_dirs = [ "3013000", "3013001", "3013002", "3013300", "1098204200", "1098264100", "1098290800" ]
dirs = [f for f in expected_path.iterdir() if f.is_dir()]
assert set([d.name for d in dirs]) == set(expected_dirs)
for d in dirs:
expected_files = ["0.png", "1.png"]
files = [f.name for f in d.iterdir() if f.is_file()]
assert set(files) == set(expected_files)
def test_servantid_download_filter(path_images: Path, path_output: Path):
test_id = 70
test_weaver = SkyeWeave(
test_id,
filters=[ 3013000, 3013001, 1098290800],
output=path_output,
assets=path_images
)
test_weaver.download()
expected_path = path_images / str(test_id)
expected_dirs = [ "3013000", "3013001", "1098290800" ]
dirs =[f for f in expected_path.iterdir() if f.is_dir()]
assert set([d.name for d in dirs]) == set(expected_dirs)
for d in dirs:
expected_files = ["0.png", "1.png"]
files = [f.name for f in d.iterdir() if f.is_file()]
assert set(files) == set(expected_files)
def test_charaid_download(path_images: Path, path_output: Path):
test_id = 3013000
test_weaver = SkyeWeave(
test_id,
output=path_output,
assets=path_images
)
test_weaver.download()
expected_path = path_images / "manual"
expected_dirs = [ "3013000" ]
dirs = [f for f in expected_path.iterdir() if f.is_dir()]
assert set([d.name for d in dirs]) == set(expected_dirs)
for d in dirs:
expected_files = ["0.png", "1.png"]
files = [f.name for f in d.iterdir() if f.is_file()]
assert set(files) == set(expected_files)