Skip to content

Commit cac608b

Browse files
committed
follow-up to #3491, made errors more consistent. fixes #3527
1 parent b69e1d7 commit cac608b

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

manim/animation/animation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ def begin(self) -> None:
193193
"""
194194
if self.run_time <= 0:
195195
raise ValueError(
196-
f"{self} has a runtime of <= 0 seconds, which cannot be rendered correctly! please set a runtime > 0"
196+
f"{self} has a run_time of <= 0 seconds, this cannot be rendered correctly. "
197+
"Please set the run_time to be positive"
197198
)
198199
self.starting_mobject = self.create_starting_mobject()
199200
if self.suspend_mobject_updating:

manim/animation/composition.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,13 @@ def get_all_mobjects(self) -> Sequence[Mobject]:
8686
def begin(self) -> None:
8787
if self.run_time <= 0:
8888
tmp = (
89-
"please set a runtime > 0"
89+
"Please set the run_time to be positive"
9090
if len(self.animations) != 0
91-
else "Please add at least one Animation"
91+
else "Please add at least one Animation with positive run_time"
9292
)
9393
raise ValueError(
94-
f"{self} has a runtime of 0 seconds. Which cannot be rendered correctly! {tmp}."
94+
f"{self} has a run_time of 0 seconds, this cannot be "
95+
f"rendered correctly. {tmp}."
9596
)
9697
if self.suspend_mobject_updating:
9798
self.group.suspend_updating()

tests/module/animation/test_composition.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ def test_animationgroup_is_passing_remover_to_nested_animationgroups():
172172

173173

174174
def test_empty_animation_group_fails():
175-
with pytest.raises(ValueError):
175+
with pytest.raises(ValueError, match="Please add at least one Animation"):
176176
AnimationGroup().begin()
177177

178178

179179
def test_empty_animation_fails():
180-
with pytest.raises(ValueError):
180+
with pytest.raises(ValueError, match="Please set the run_time to be positive"):
181181
FadeIn(None, run_time=0).begin()

0 commit comments

Comments
 (0)