MCPcopy Index your code
hub / github.com/Breakthrough/PySceneDetect / test_cli_save_images_path_handling

Function test_cli_save_images_path_handling

tests/test_cli.py:618–636  ·  view source on GitHub ↗

Test `save-images` ability to handle UTF-8 paths.

(tmp_path: Path)

Source from the content-addressed store, hash-verified

616
617
618def test_cli_save_images_path_handling(tmp_path: Path):
619 """Test `save-images` ability to handle UTF-8 paths."""
620 assert (
621 invoke_scenedetect(
622 "-i {{VIDEO}} -s {{STATS}} time {{TIME}} {{DETECTOR}} save-images -f {}".format(
623 "電腦檔案-$SCENE_NUMBER-$IMAGE_NUMBER"
624 ),
625 output_dir=tmp_path,
626 )
627 == 0
628 )
629 images = [image for image in tmp_path.glob("電腦檔案-*.jpg")]
630 # Should detect two scenes and generate 3 images per scene with above params.
631 assert len(images) == 6
632 # Check the created images can be read and have the correct size.
633 # We can't use `cv2.imread` here since it doesn't seem to work correctly with UTF-8 paths.
634 image = cv2.imdecode(np.fromfile(images[0], dtype=np.uint8), cv2.IMREAD_UNCHANGED)
635 assert image is not None
636 assert image.shape == (544, 1280, 3)
637
638
639# TODO(https://scenedetect.com/issues/134): This works fine with OpenCV currently, but needs to be

Callers

nothing calls this directly

Calls 2

invoke_scenedetectFunction · 0.85
formatMethod · 0.80

Tested by

no test coverage detected