File size: 607 Bytes
3eedfa7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | from __future__ import annotations
from manim import Circle, ReplacementTransform, Scene, Square, VGroup
def test_no_duplicate_references():
scene = Scene()
c = Circle()
sq = Square()
scene.add(c, sq)
scene.play(ReplacementTransform(c, sq))
assert len(scene.mobjects) == 1
assert scene.mobjects[0] is sq
def test_duplicate_references_in_group():
scene = Scene()
c = Circle()
sq = Square()
vg = VGroup(c, sq)
scene.add(vg)
scene.play(ReplacementTransform(c, sq))
submobs = vg.submobjects
assert len(submobs) == 1
assert submobs[0] is sq
|