Industry leading face manipulation platform
Extend testing
henryruhseb2f794ece14
diff --git a/tests/test_vision.py b/tests/test_vision.pyindex d79fb07c..f315638b 100644--- a/tests/test_vision.py+++ b/tests/test_vision.py@@ -3,8 +3,8 @@ import subprocessimport pytestfrom facefusion.download import conditional_download-from facefusion.vision import calc_histogram_difference, count_trim_frame_total, count_video_frame_total, create_image_resolutions, create_video_resolutions, detect_image_resolution, detect_video_duration, detect_video_fps, detect_video_resolution, get_video_frame, match_frame_color, normalize_resolution, pack_resolution, read_image, restrict_image_resolution, restrict_trim_frame, restrict_video_fps, restrict_video_resolution, unpack_resolution-from .helper import get_test_example_file, get_test_examples_directory+from facefusion.vision import calc_histogram_difference, count_trim_frame_total, count_video_frame_total, create_image_resolutions, create_video_resolutions, detect_image_resolution, detect_video_duration, detect_video_fps, detect_video_resolution, get_video_frame, match_frame_color, normalize_resolution, pack_resolution, read_image, restrict_image_resolution, restrict_trim_frame, restrict_video_fps, restrict_video_resolution, unpack_resolution, write_image+from .helper import get_test_example_file, get_test_examples_directory, prepare_test_output_directory, get_test_output_file@pytest.fixture(scope = 'module', autouse = True)@@ -16,6 +16,7 @@ def before_all() -> None:'https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-1080p.mp4'])subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('target-240p.jpg') ])+ subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', get_test_example_file('目标-240p.webp') ])subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-1080p.mp4'), '-vframes', '1', get_test_example_file('target-1080p.jpg') ])subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', '-vf', 'hue=s=0', get_test_example_file('target-240p-0sat.jpg') ])subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-240p.mp4'), '-vframes', '1', '-vf', 'transpose=0', get_test_example_file('target-240p-90deg.jpg') ])@@ -27,6 +28,25 @@ def before_all() -> None:subprocess.run([ 'ffmpeg', '-i', get_test_example_file('target-1080p.mp4'), '-vf', 'transpose=0', get_test_example_file('target-1080p-90deg.mp4') ])[email protected](scope = 'function', autouse = True)+def before_each() -> None:+ prepare_test_output_directory()+++def test_read_image() -> None:+ assert read_image(get_test_example_file('target-240p.jpg')).shape == (226, 426, 3)+ assert read_image(get_test_example_file('目标-240p.webp')).shape == (226, 426, 3)+ assert read_image('invalid') is None+++def test_write_image() -> None:+ vision_frame = read_image(get_test_example_file('target-240p.jpg'))++ assert write_image(get_test_output_file('target-240p.jpg'), vision_frame) is True+ assert write_image(get_test_output_file('目标-240p.webp'), vision_frame) is True++def test_detect_image_resolution() -> None:assert detect_image_resolution(get_test_example_file('target-240p.jpg')) == (426, 226)assert detect_image_resolution(get_test_example_file('target-240p-90deg.jpg')) == (226, 426)