diff --git a/alist_sync/models.py b/alist_sync/models.py index 585550c..dff9c9b 100644 --- a/alist_sync/models.py +++ b/alist_sync/models.py @@ -7,9 +7,11 @@ from alist_sync.alist_client import AlistClient -__all__ = ["AlistServer", "SyncDir", "CopyTask", "RemoveTask", "SyncJob", "Checker"] +__all__ = ["AlistServer", "SyncDir", "CopyTask", + "RemoveTask", "SyncJob", "Checker"] -CopyStatusModify = Literal["init", "created", "waiting", "getting src object", "", "running", "success"] +CopyStatusModify = Literal["init", "created", "waiting", + "getting src object", "", "running", "success"] class AlistServer(BaseModel): @@ -158,10 +160,19 @@ def checker(cls, *scanned_dirs): scanned_dir.base_path ) try: - _result[PurePosixPath(r_path)].setdefault(PurePosixPath(scanned_dir.base_path), item) + _result[PurePosixPath(r_path)].setdefault( + PurePosixPath(scanned_dir.base_path), + item + ) except KeyError: - _result[PurePosixPath(r_path)] = {PurePosixPath(scanned_dir.base_path): item} - return cls(mixmatrix=_result, cols=[PurePosixPath(t.base_path) for t in scanned_dirs]) + _result[PurePosixPath(r_path)] = { + PurePosixPath(scanned_dir.base_path): item + } + + return cls( + matrix=_result, + cols=[PurePosixPath(t.base_path) for t in scanned_dirs] + ) def model_dump_table(self): """""" @@ -188,5 +199,5 @@ def model_dump_table(self): checker = Checker.checker(*[SyncDir(**s) for s in json.load( Path(__file__).parent.parent.joinpath('tests/resource/SyncDirs.json').open()) - ]) + ]) checker.model_dump_table() diff --git a/tests/test_check.py b/tests/test_check.py index 7a004bb..04618be 100644 --- a/tests/test_check.py +++ b/tests/test_check.py @@ -3,24 +3,25 @@ import pytest -from alist_sync.models import SyncDir, CheckModel -from alist_sync.checker import Checker +from alist_sync.models import SyncDir, Checker SUP_DIR = Path(__file__).parent.joinpath('resource') -@pytest.mark.parametrize( - "scanned_dirs", - [[SyncDir(**s) for s in json.load(SUP_DIR.joinpath('SyncDirs.json').open())]] -) -def test_checker(scanned_dirs): - checker = Checker(*scanned_dirs) - assert checker.result +# @pytest.mark.skip +# @pytest.mark.parametrize( +# "scanned_dirs", +# [[SyncDir(**s) for s in json.load(SUP_DIR.joinpath('SyncDirs.json').open())]] +# ) +# def test_checker(scanned_dirs): +# checker = Checker(*scanned_dirs) +# assert checker.result + @pytest.mark.parametrize( "scanned_dirs", [[SyncDir(**s) for s in json.load(SUP_DIR.joinpath('SyncDirs.json').open())]] ) def test_check(scanned_dirs): - checker = CheckModel.checker(*scanned_dirs) - assert checker.matrix \ No newline at end of file + checker = Checker.checker(*scanned_dirs) + assert checker.matrix