Repository: ManimCommunity/manim
File: manim/scene/scene.py (Python)

Code before:
        # raise a ValueError
        *proto_animations: AnimationProtocol
        | _AnimationBuilder[OpenGLMobject]
        | OpenGLMobject,
        run_time: float | None = None,
        rate_func: Callable[[float], float] | None = None,
        lag_ratio: float | None = None,
    ) -> None:
        if len(proto_animations) == 0:
            logger.warning("Called Scene.play with no animations")
            return

        # Build _AnimationBuilders.
        animations = [prepare_animation(x) for x in proto_animations]
        for anim in animations:
            anim.update_rate_info(run_time, rate_func, lag_ratio)

        # Validate the final run_time.
        total_run_time = max(anim.get_run_time() for anim in animations)
        new_total_run_time = self.validate_run_time(
            total_run_time, self.play, "total run_time"
        )
        if new_total_run_time != total_run_time:
            for anim in animations:
                anim.update_rate_info(new_total_run_time)
        self.animations = animations
        # NOTE: Should be changed at some point with the 2 pass rendering system 21.06.2024
        self.manager._play(*animations)

    def wait(
        self,
        duration: float = DEFAULT_WAIT_TIME,
        stop_condition: Callable[[], bool] | None = None,
        frozen_frame: bool | None = None,
        note: str | None = None,
        ignore_presenter_mode: bool = False,
    ) -> None:
        duration = self.validate_run_time(duration, self.wait, "duration")
        if frozen_frame is None:
            frozen_frame = not self.should_update_mobjects()
        self.play(
            Wait(duration, stop_condition=stop_condition, frozen_frame=frozen_frame)
        )
        # if (
        #     self.presenter_mode
        #     and not self.skip_animations
        #     and not ignore_presenter_mode
        # ):
        #     if note:
        #         logger.info(note)
        #     self.hold_loop()

Review comment (suggestion):
I don't think we should be storing the animations as an attribute on `Scene`. Is the only place this attribute is accessed in tests? If so, it may be easier just to `unittest.Mock` the method and use the `call_args` to access the animations.

Code after:
        # the OpenGLMobject is a side-effect of the return type of animate, it will
        # raise a ValueError
        *proto_animations: AnimationProtocol
        | _AnimationBuilder[OpenGLMobject]
        | OpenGLMobject,
        run_time: float | None = None,
        rate_func: Callable[[float], float] | None = None,
        lag_ratio: float | None = None,
    ) -> None:
        if len(proto_animations) == 0:
            logger.warning("Called Scene.play with no animations")
            return

        # Build _AnimationBuilders.
        animations = [prepare_animation(x) for x in proto_animations]
        for anim in animations:
            anim.update_rate_info(run_time, rate_func, lag_ratio)

        # Validate the final run_time.
        total_run_time = max(anim.get_run_time() for anim in animations)
        new_total_run_time = self.validate_run_time(
            total_run_time, self.play, "total run_time"
        )
        if new_total_run_time != total_run_time:
            for anim in animations:
                anim.update_rate_info(new_total_run_time)

        # NOTE: Should be changed at some point with the 2 pass rendering system 21.06.2024
        self.manager._play(*animations)

    def wait(
        self,
        duration: float = DEFAULT_WAIT_TIME,
        stop_condition: Callable[[], bool] | None = None,
        frozen_frame: bool | None = None,
        note: str | None = None,
        ignore_presenter_mode: bool = False,
    ) -> None:
        duration = self.validate_run_time(duration, self.wait, "duration")
        if frozen_frame is None and stop_condition is None:
            frozen_frame = not self.should_update_mobjects()
        self.play(
            Wait(duration, stop_condition=stop_condition, frozen_frame=frozen_frame)
        )
        # if (
        #     self.presenter_mode
        #     and not self.skip_animations
        #     and not ignore_presenter_mode
        # ):
        #     if note:
        #         logger.info(note)