Coverage for tests/test_video_utils.py: 100%

1 from image_utils.video_utils import write_video

2 from image_utils import Im

3 import numpy as np

4 import pytest

5 from pathlib import Path

6

7 img_path = Path('tests/flower.jpg')

8 save_path = Path(__file__).parent / 'output'

9

10

11@pytest.mark.parametrize("fps", [1, 10])

12@pytest.mark.parametrize("frames", [1, 10])

13 def test_write_video(frames, fps):

14 img = Im.open(img_path).np

15 video = np.stack([img for _ in range(frames)], axis=0)

16 write_video(video, save_path / 'test.mp4', fps=fps)