manim/tests/test_linear_transformation_scene.py
adeshpande c8fe4d9e4f
Use ruff for pytest style (#3872)
* Add ruff config for pytest

* Fixes for pre-commit

* Changes to make pre-commit happy (Unrelated to PR)

---------

Co-authored-by: Tristan Schulz <tristanschulz1200@gmail.com>
2024-07-21 14:37:57 +00:00

25 lines
808 B
Python

from manim import RIGHT, UP, LinearTransformationScene, Vector, VGroup
__module_test__ = "vector_space_scene"
def test_ghost_vectors_len_and_types():
scene = LinearTransformationScene()
scene.leave_ghost_vectors = True
# prepare vectors (they require a vmobject as their target)
v1, v2 = Vector(RIGHT), Vector(RIGHT)
v1.target, v2.target = Vector(UP), Vector(UP)
# ghost_vector addition is in this method
scene.get_piece_movement((v1, v2))
ghosts = scene.get_ghost_vectors()
assert len(ghosts) == 1
# check if there are two vectors in the ghost vector VGroup
assert len(ghosts[0]) == 2
# check types of ghost vectors
assert isinstance(ghosts, VGroup)
assert isinstance(ghosts[0], VGroup)
assert all(isinstance(x, Vector) for x in ghosts[0])