From 10a5755bd62a203e21ea4081ab871f4998bff6a4 Mon Sep 17 00:00:00 2001 From: JasonGrace2282 Date: Wed, 3 Jul 2024 08:27:40 -0400 Subject: [PATCH 1/2] Fix config.format not updating config.movie_file_extension --- manim/_config/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/manim/_config/utils.py b/manim/_config/utils.py index 0316311778..6c2492d95e 100644 --- a/manim/_config/utils.py +++ b/manim/_config/utils.py @@ -1052,6 +1052,7 @@ def format(self, val: str) -> None: val, [None, "png", "gif", "mp4", "mov", "webm"], ) + self.resolve_movie_file_extension(self.transparent) if self.format == "webm": logging.getLogger("manim").warning( "Output format set as webm, this can be slower than other formats", From a790285aa18da48d1e3da75fe99e19308dc00ab6 Mon Sep 17 00:00:00 2001 From: JasonGrace2282 Date: Fri, 12 Jul 2024 16:54:41 -0400 Subject: [PATCH 2/2] Add test --- tests/test_config.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test_config.py b/tests/test_config.py index 18f7691cfc..6429f1d5cf 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -4,6 +4,7 @@ from pathlib import Path import numpy as np +import pytest from manim import WHITE, Scene, Square, Tex, Text, tempconfig from manim._config.utils import ManimConfig @@ -33,6 +34,20 @@ def test_tempconfig(config): assert config[k] == v +@pytest.mark.parametrize( + ("format", "expected_file_extension"), + [ + ("mp4", ".mp4"), + ("webm", ".webm"), + ("mov", ".mov"), + ("gif", ".mp4"), + ], +) +def test_resolve_file_extensions(config, format, expected_file_extension): + config.format = format + assert config.movie_file_extension == expected_file_extension + + class MyScene(Scene): def construct(self): self.add(Square())