mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
Merge branch 'experimental' of https://github.com/ManimCommunity/manim into exp_replace_openglmob_imports
This commit is contained in:
commit
06c989fbe1
2 changed files with 21 additions and 4 deletions
|
|
@ -20,6 +20,16 @@ FRAME_MISMATCH_RATIO_TOLERANCE = 1e-5
|
|||
logger = logging.getLogger("manim")
|
||||
|
||||
|
||||
class GraphicalDeviationError(Exception):
|
||||
# The __module__ parameter is set to "builtins" to avoid the full
|
||||
# specifier for the exception to be included in the output from pytest.
|
||||
# That is go from
|
||||
# manim.utils.testing._frames_testers.GraphicalDeviationError
|
||||
# to
|
||||
# GraphicalDeviationError
|
||||
__module__ = "builtins"
|
||||
|
||||
|
||||
class _FramesTester:
|
||||
def __init__(self, file_path: Path, show_diff: bool = False) -> None:
|
||||
self._file_path = file_path
|
||||
|
|
@ -81,7 +91,9 @@ class _FramesTester:
|
|||
self._frames[frame_number],
|
||||
self._file_path.name,
|
||||
)
|
||||
raise
|
||||
raise GraphicalDeviationError(
|
||||
f"{number_of_mismatches} pixels differ when comparing with '{self._file_path.name}'"
|
||||
) from None
|
||||
|
||||
|
||||
class _ControlDataWriter(_FramesTester):
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Self
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
|
|
@ -22,6 +23,7 @@ from manim import (
|
|||
Wait,
|
||||
Write,
|
||||
)
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject as Mobject
|
||||
|
||||
|
||||
def test_succession_timing():
|
||||
|
|
@ -182,16 +184,19 @@ def test_animationgroup_is_passing_remover_to_nested_animationgroups():
|
|||
|
||||
def test_animationgroup_calls_finish():
|
||||
class MyAnimation(Animation):
|
||||
def __init__(self, mobject):
|
||||
def __init__(self, mobject: Mobject):
|
||||
super().__init__(mobject)
|
||||
self.finished = False
|
||||
|
||||
def interpolate_mobject(self, alpha):
|
||||
def interpolate_mobject(self, alpha: float) -> None:
|
||||
pass
|
||||
|
||||
def finish(self):
|
||||
def finish(self) -> None:
|
||||
self.finished = True
|
||||
|
||||
def interpolate_submobject(self, *args: Any, **kwargs: Any) -> Self:
|
||||
return self
|
||||
|
||||
manager = Manager(Scene)
|
||||
scene = manager.scene
|
||||
sqr_animation = MyAnimation(Square())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue