A community-maintained Python framework for creating mathematical animations.
Fix LaggedStartMap unpacking submobjects with the default arg_creator (#4965)
Sai Asish Y9f99d1fd7906
diff --git a/manim/animation/composition.py b/manim/animation/composition.pyindex 82488425f..41f8b4329 100644--- a/manim/animation/composition.py+++ b/manim/animation/composition.py@@ -408,8 +408,8 @@ class LaggedStartMap(LaggedStart):):if arg_creator is None:- def identity(mob: Mobject) -> Mobject:- return mob+ def identity(mob: Mobject) -> tuple[Mobject]:+ return (mob,)arg_creator = identitydiff --git a/tests/module/animation/test_composition.py b/tests/module/animation/test_composition.pyindex 3c7a3dcc3..7bb50cd7a 100644--- a/tests/module/animation/test_composition.py+++ b/tests/module/animation/test_composition.py@@ -208,6 +208,24 @@ def test_laggedstartmap_only_passes_kwargs_to_subanimations():)+def test_laggedstartmap_default_arg_creator_keeps_submobject_whole():+ inner1 = VGroup(Square(), Square())+ inner2 = VGroup(Circle(), Circle())+ outer = VGroup(inner1, inner2)++ received_args = []++ class RecordingAnimation(Animation):+ def __init__(self, *args, **kwargs):+ received_args.append(args)+ super().__init__(args[0], **kwargs)++ LaggedStartMap(RecordingAnimation, outer)++ assert all(len(args) == 1 for args in received_args)+ assert [args[0] for args in received_args] == [inner1, inner2]++def test_empty_animation_group_fails():with pytest.raises(ValueError, match="Please add at least one subanimation."):AnimationGroup().begin()