Skip to content
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

chore(lib): Remove old validation check preventing loop=True with auto_next=True #445

Merged
merged 3 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed whitespace issue in default RevealJS template.
[#442](https://github.com/jeertmans/manim-slides/pull/442)

(unreleased-chore)=
### Chore

- Removed an old validation check that prevented setting `loop=True` with
`auto_next=True` on `next_slide()`
[#445](https://github.com/jeertmans/manim-slides/pull/445)

(v5.1.7)=
## [v5.1.7](https://github.com/jeertmans/manim-slides/compare/v5.1.6...v5.1.7)

Expand Down
15 changes: 0 additions & 15 deletions manim_slides/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,21 +262,6 @@ def start_animation_is_before_end(

return pre_slide_config

@model_validator(mode="after")
@classmethod
def loop_and_auto_next_disallowed(
cls, pre_slide_config: "PreSlideConfig"
) -> "PreSlideConfig":
if pre_slide_config.loop and pre_slide_config.auto_next:
raise ValueError(
"You cannot have both `loop=True` and `auto_next=True`, "
"because a looping slide has no ending. "
"This may be supported in the future if "
"https://github.com/jeertmans/manim-slides/pull/299 gets merged."
)

return pre_slide_config

@property
def slides_slice(self) -> slice:
return slice(self.start_animation, self.end_animation)
Expand Down
6 changes: 2 additions & 4 deletions tests/test_slide.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
Text,
)
from packaging import version
from pydantic import ValidationError

from manim_slides.config import PresentationConfig
from manim_slides.defaults import FOLDER_PATH
Expand Down Expand Up @@ -193,7 +192,7 @@ def construct(self) -> None:
assert not self._base_slide_config.auto_next

@assert_constructs
class TestLoopAndAutoNextFails(Slide):
class TestLoopAndAutoNextSucceeds(Slide):
def construct(self) -> None:
text = Text("Some text")

Expand All @@ -202,8 +201,7 @@ def construct(self) -> None:
self.next_slide(loop=True, auto_next=True)
self.play(text.animate.scale(2))

with pytest.raises(ValidationError):
self.next_slide()
self.next_slide()

@assert_constructs
class TestPlaybackRate(Slide):
Expand Down
Loading