Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

follow-up to #3491, made errors more consistent. fixes #3527

Benjamin Hacklcac608bf2aa9
diff --git a/manim/animation/animation.py b/manim/animation/animation.py
index 75629ecb5..cb8fcaddf 100644
--- a/manim/animation/animation.py
+++ b/manim/animation/animation.py
@@ -193,7 +193,8 @@ class Animation:
"""
if self.run_time <= 0:
raise ValueError(
- f"{self} has a runtime of <= 0 seconds, which cannot be rendered correctly! please set a runtime > 0"
+ f"{self} has a run_time of <= 0 seconds, this cannot be rendered correctly. "
+ "Please set the run_time to be positive"
)
self.starting_mobject = self.create_starting_mobject()
if self.suspend_mobject_updating:
diff --git a/manim/animation/composition.py b/manim/animation/composition.py
index ee26eb504..ff219405f 100644
--- a/manim/animation/composition.py
+++ b/manim/animation/composition.py
@@ -86,12 +86,13 @@ class AnimationGroup(Animation):
def begin(self) -> None:
if self.run_time <= 0:
tmp = (
- "please set a runtime > 0"
+ "Please set the run_time to be positive"
if len(self.animations) != 0
- else "Please add at least one Animation"
+ else "Please add at least one Animation with positive run_time"
)
raise ValueError(
- f"{self} has a runtime of 0 seconds. Which cannot be rendered correctly! {tmp}."
+ f"{self} has a run_time of 0 seconds, this cannot be "
+ f"rendered correctly. {tmp}."
)
if self.suspend_mobject_updating:
self.group.suspend_updating()
diff --git a/tests/module/animation/test_composition.py b/tests/module/animation/test_composition.py
index 1f6d6bf5c..6837699fd 100644
--- a/tests/module/animation/test_composition.py
+++ b/tests/module/animation/test_composition.py
@@ -172,10 +172,10 @@ def test_animationgroup_is_passing_remover_to_nested_animationgroups():
def test_empty_animation_group_fails():
- with pytest.raises(ValueError):
+ with pytest.raises(ValueError, match="Please add at least one Animation"):
AnimationGroup().begin()
def test_empty_animation_fails():
- with pytest.raises(ValueError):
+ with pytest.raises(ValueError, match="Please set the run_time to be positive"):
FadeIn(None, run_time=0).begin()