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

Function test_reproducible_scene

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

Source from the content-addressed store, hash-verified

104
105
106def test_reproducible_scene(dry_run):
107 import numpy as np
108
109 scene = Scene(random_seed=42)
110 dots1 = []
111 for _ in range(10):
112 dot = Dot(np.random.uniform(-3, 3, size=3)) # noqa: NPY002
113 dots1.append(dot)
114 scene.add(*dots1)
115
116 scene2 = Scene(random_seed=42)
117 dots2 = []
118 for _ in range(5):
119 dot = Dot(np.random.uniform(-3, 3, size=3)) # noqa: NPY002
120 dots2.append(dot)
121 scene2.add(*dots2)
122
123 for d1, d2 in zip(dots1, dots2, strict=False):
124 np.testing.assert_allclose(d1.get_center(), d2.get_center())
125
126
127def test_random_color_reproducibility_with_seed(dry_run):

Callers

nothing calls this directly

Calls 5

addMethod · 0.95
SceneClass · 0.90
DotClass · 0.90
appendMethod · 0.45
get_centerMethod · 0.45

Tested by

no test coverage detected