From 339cd2aab2e667601aa80dc0c990c18b9813294b Mon Sep 17 00:00:00 2001 From: henryruhs Date: Wed, 7 Oct 2026 10:28:37 +0200 Subject: [PATCH] improve code coverage part3 --- tests/test_model_helper.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/test_model_helper.py diff --git a/tests/test_model_helper.py b/tests/test_model_helper.py new file mode 100644 index 00000000..9adc0edb --- /dev/null +++ b/tests/test_model_helper.py @@ -0,0 +1,24 @@ +import pytest + +from facefusion import state_manager +from facefusion.download import conditional_download, resolve_download_url +from facefusion.filesystem import resolve_relative_path +from facefusion.model_helper import get_static_model_initializer + + +@pytest.fixture(scope = 'module', autouse = True) +def before_all() -> None: + state_manager.init() + state_manager.init_item('download_providers', [ 'github' ]) + + conditional_download(resolve_relative_path('../.assets/models'), + [ + resolve_download_url('models-3.0.0', 'inswapper_128.hash'), + resolve_download_url('models-3.0.0', 'inswapper_128.onnx') + ]) + + +def test_get_static_model_initializer() -> None: + model_path = resolve_relative_path('../.assets/models/inswapper_128.onnx') + + assert get_static_model_initializer(model_path).shape == (512, 512)