Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

add test for shifted Axes

Benjamin Hackla4a4fc9dfd4e
diff --git a/tests/test_axes_shift.py b/tests/test_axes_shift.py
index 6cf996e37..70a2b2b00 100644
--- a/tests/test_axes_shift.py
+++ b/tests/test_axes_shift.py
@@ -1,6 +1,7 @@
import numpy as np
import pytest
+from manim.mobject.coordinate_systems import Axes
from manim.scene.graph_scene import GraphScene
@@ -42,3 +43,8 @@ def test_axes_with_xy_shift():
G.setup_axes()
assert all(np.isclose(G.graph_origin, G.x_axis.n2p(1)))
assert all(np.isclose(G.graph_origin, G.y_axis.n2p(-5)))
+
+def test_axes_origin_shift():
+ ax = Axes(x_range=(5, 10, 1), y_range=(40, 45, 0.5))
+ assert np.allclose(ax.coords_to_point(5, 40), ax.x_axis.number_to_point(5))
+ assert np.allclose(ax.coords_to_point(5, 40), ax.y_axis.number_to_point(40))
\ No newline at end of file