|
3 | 3 | import math |
4 | 4 |
|
5 | 5 | import numpy as np |
| 6 | +import numpy.testing as nt |
6 | 7 | import pytest |
7 | 8 |
|
8 | 9 | from manim import ( |
@@ -197,42 +198,42 @@ def test_input_to_graph_point(): |
197 | 198 |
|
198 | 199 | def test_matmul_operations(): |
199 | 200 | ax = Axes() |
200 | | - assert (ax @ (1, 2) == ax.coords_to_point(1, 2)).all() |
| 201 | + nt.assert_equal(ax @ (1, 2), ax.coords_to_point(1, 2)) |
201 | 202 | # should work with mobjects too, using their center |
202 | 203 | mob = Dot().move_to((1, 2, 0)) |
203 | | - assert (ax @ mob == ax.coords_to_point(1, 2)).all() |
| 204 | + nt.assert_equal(ax @ mob, ax.coords_to_point(1, 2)) |
204 | 205 |
|
205 | 206 | # other coordinate systems like PolarPlane and ComplexPlane should override __matmul__ indirectly |
206 | 207 | polar = PolarPlane() |
207 | | - assert (polar @ (1, 2) == polar.polar_to_point(1, 2)).all() |
| 208 | + nt.assert_equal(polar @ (1, 2), polar.polar_to_point(1, 2)) |
208 | 209 |
|
209 | 210 | complx = ComplexPlane() |
210 | | - assert (complx @ (1 + 2j) == complx.number_to_point(1 + 2j)).all() |
| 211 | + nt.assert_equal(complx @ (1 + 2j), complx.number_to_point(1 + 2j)) |
211 | 212 |
|
212 | 213 | # Numberline doesn't inherit from CoordinateSystem, but it should still work |
213 | 214 | n = NumberLine() |
214 | | - assert (n @ 3 == n.number_to_point(3)).all() |
| 215 | + nt.assert_equal(n @ 3, n.number_to_point(3)) |
215 | 216 |
|
216 | 217 |
|
217 | 218 | def test_rmatmul_operations(): |
218 | 219 | point = (1, 2, 0) |
219 | 220 |
|
220 | 221 | ax = Axes() |
221 | | - assert (point @ ax == ax.point_to_coords(point)).all() |
| 222 | + nt.assert_equal(point @ ax, ax.point_to_coords(point)) |
222 | 223 |
|
223 | 224 | polar = PolarPlane() |
224 | 225 | assert point @ polar == polar.point_to_polar(point) |
225 | 226 |
|
226 | 227 | complx = ComplexPlane() |
227 | | - assert point @ complx == complx.point_to_number(point) |
| 228 | + nt.assert_equal(point @ complx, complx.point_to_number(point)) |
228 | 229 |
|
229 | 230 | n = NumberLine() |
230 | 231 | point = n @ 4 |
231 | 232 |
|
232 | | - assert ( |
233 | | - tuple(point) @ n # ndarray overrides __matmul__ |
234 | | - == n.point_to_number(point) |
235 | | - ).all() |
| 233 | + nt.assert_equal( |
| 234 | + tuple(point) @ n, # ndarray overrides __matmul__ |
| 235 | + n.point_to_number(point), |
| 236 | + ) |
236 | 237 |
|
237 | 238 | mob = Dot().move_to(point) |
238 | | - assert (mob @ n == n.point_to_number(mob.get_center())).all() |
| 239 | + nt.assert_equal(mob @ n, n.point_to_number(mob.get_center())) |
0 commit comments