MCPcopy
hub / github.com/ManimCommunity/manim / test_replace

Function test_replace

tests/module/scene/test_scene.py:75–103  ·  view source on GitHub ↗
(dry_run)

Source from the content-addressed store, hash-verified

73
74
75def test_replace(dry_run):
76 def assert_names(mobjs, names):
77 assert len(mobjs) == len(names)
78 for i in range(0, len(mobjs)):
79 assert mobjs[i].name == names[i]
80
81 scene = Scene()
82
83 first = Mobject(name="first")
84 second = Mobject(name="second")
85 third = Mobject(name="third")
86 fourth = Mobject(name="fourth")
87
88 scene.add(first)
89 scene.add(Group(second, third, name="group"))
90 scene.add(fourth)
91 assert_names(scene.mobjects, ["first", "group", "fourth"])
92 assert_names(scene.mobjects[1], ["second", "third"])
93
94 alpha = Mobject(name="alpha")
95 beta = Mobject(name="beta")
96
97 scene.replace(first, alpha)
98 assert_names(scene.mobjects, ["alpha", "group", "fourth"])
99 assert_names(scene.mobjects[1], ["second", "third"])
100
101 scene.replace(second, beta)
102 assert_names(scene.mobjects, ["alpha", "group", "fourth"])
103 assert_names(scene.mobjects[1], ["beta", "third"])
104
105
106def test_reproducible_scene(dry_run):

Callers

nothing calls this directly

Calls 6

addMethod · 0.95
replaceMethod · 0.95
SceneClass · 0.90
MobjectClass · 0.90
GroupClass · 0.90
assert_namesFunction · 0.85

Tested by

no test coverage detected