refactor: refactor some functions

This commit is contained in:
Dowon
2024-05-15 22:13:06 +09:00
parent e05104a220
commit f12f66c298
4 changed files with 36 additions and 5 deletions

View File

@@ -1,5 +1,7 @@
from __future__ import annotations
import pytest
from adetailer.args import ALL_ARGS, ADetailerArgs
@@ -12,3 +14,21 @@ def test_all_args() -> None:
if attr == "is_api":
continue
assert attr in ALL_ARGS.attrs, attr
@pytest.mark.parametrize(
("ad_model", "expect"),
[("mediapipe_face_full", True), ("face_yolov8n.pt", False)],
)
def test_is_mediapipe(ad_model: str, expect: bool) -> None:
args = ADetailerArgs(ad_model=ad_model)
assert args.is_mediapipe() is expect
@pytest.mark.parametrize(
("ad_model", "expect"),
[("mediapipe_face_full", False), ("face_yolov8n.pt", False), ("None", True)],
)
def test_need_skip(ad_model: str, expect: bool) -> None:
args = ADetailerArgs(ad_model=ad_model)
assert args.need_skip() is expect