-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fix animations with zero runtime length to give a useful error instead of a broken pipe #3491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a980b90
3d8f269
3c5bd82
5fd208c
de8a55d
fdc0ccd
cfdc8c5
d932b57
d4621e4
003952b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
MrDiver marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -81,6 +81,15 @@ def get_all_mobjects(self) -> Sequence[Mobject]: | |||||
return list(self.group) | ||||||
|
||||||
def begin(self) -> None: | ||||||
if self.run_time <= 0: | ||||||
tmp = ( | ||||||
"please set a runtime > 0" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
if len(self.animations) != 0 | ||||||
else "Please add at least one Animation" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
) | ||||||
raise ValueError( | ||||||
f"{self} has a runtime of 0 seconds. Which cannot be rendered correctly! {tmp}." | ||||||
MrDiver marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
) | ||||||
if self.suspend_mobject_updating: | ||||||
self.group.suspend_updating() | ||||||
for anim in self.animations: | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -169,3 +169,13 @@ def test_animationgroup_is_passing_remover_to_nested_animationgroups(): | |||||
assert sqr_animation.remover | ||||||
assert circ_animation.remover | ||||||
assert polygon_animation.remover | ||||||
|
||||||
|
||||||
def test_empty_animation_group_fails(): | ||||||
with pytest.raises(ValueError): | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
AnimationGroup().begin() | ||||||
MrDiver marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
|
||||||
def test_empty_animation_fails(): | ||||||
with pytest.raises(ValueError): | ||||||
FadeIn(None, run_time=0).begin() |
Uh oh!
There was an error while loading. Please reload this page.