Skip to content

Commit

Permalink
chore(lib): Remove old validation check preventing loop=True with `…
Browse files Browse the repository at this point in the history
…auto_next=True` (#445)

* remove old validation check

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update CHANGELOG.md

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
mateuszdrwal and pre-commit-ci[bot] authored Jun 2, 2024
1 parent 9460f6b commit 0aa624c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
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

0 comments on commit 0aa624c

Please sign in to comment.