Download ComfyUI-ShotSplitter/tests/test_first_frame_reader.py from parlorsky/instara-models: direct link, hf CLI and curl.
- Browser
- Download file 1.21 kB
-
https://huggingface.co/parlorsky/instara-models/resolve/main/ComfyUI-ShotSplitter/tests/test_first_frame_reader.py
- Command line
-
hf download hf://parlorsky/instara-models/ComfyUI-ShotSplitter/tests/test_first_frame_reader.py
-
curl -L -o test_first_frame_reader.py https://huggingface.co/parlorsky/instara-models/resolve/main/ComfyUI-ShotSplitter/tests/test_first_frame_reader.py
1.21 kB
| """Smoke test: read first frames of existing sample videos.""" | |
| import os | |
| import pytest | |
| from first_frame_reader import read_first_frames | |
| THREESHOT = "/workspace/ComfyUI/input/test_3shots.mp4" | |
| IMBA = "/workspace/ComfyUI/input/imba.mp4" | |
| def test_read_single_clip_returns_1x_tensor(): | |
| t = read_first_frames([THREESHOT]) | |
| assert t.shape[0] == 1 | |
| assert t.ndim == 4 | |
| assert t.shape[3] == 3 | |
| assert t.dtype.is_floating_point | |
| assert 0.0 <= t.min().item() and t.max().item() <= 1.0 | |
| def test_read_multiple_clips_uses_first_as_reference_size(): | |
| t = read_first_frames([THREESHOT, IMBA]) | |
| assert t.shape[0] == 2 | |
| # Second clip should be resized to match first | |
| assert t[0].shape == t[1].shape | |
| def test_read_empty_list_returns_empty_tensor(): | |
| t = read_first_frames([]) | |
| assert t.shape[0] == 0 | |
| def test_read_missing_file_returns_black_fallback(): | |
| t = read_first_frames(["/nonexistent/fake_clip.mp4"]) | |
| assert t.shape[0] == 1 | |
| # Black frame: all zeros | |
| assert t.max().item() == 0.0 | |