Skip to content

Commit 5fb819d

Browse files
committed
add unit test for ReplacementTransform
1 parent 5e68928 commit 5fb819d

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from __future__ import annotations
2+
3+
from manim import Circle, ReplacementTransform, Scene, Square, VGroup
4+
5+
6+
def test_no_duplicate_references():
7+
scene = Scene()
8+
c = Circle()
9+
sq = Square()
10+
scene.add(c, sq)
11+
12+
scene.play(ReplacementTransform(c, sq))
13+
assert len(scene.mobjects) == 1
14+
assert scene.mobjects[0] is sq
15+
16+
17+
def test_duplicate_references_in_group():
18+
scene = Scene()
19+
c = Circle()
20+
sq = Square()
21+
vg = VGroup(c, sq)
22+
scene.add(vg)
23+
24+
scene.play(ReplacementTransform(c, sq))
25+
submobs = vg.submobjects
26+
assert len(submobs) == 1
27+
assert submobs[0] is sq

0 commit comments

Comments
 (0)