skyeweave/tests/test_02_download.py
Firq 56c1d5427a
All checks were successful
/ mypy (push) Successful in 15s
/ tests (push) Successful in 52s
/ pylint (push) Successful in 10s
Added testing
2024-10-20 21:38:22 +02:00

67 lines
2 KiB
Python

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)