manim/tests/test_graphical_units/test_numbers.py
GameDungeon daf23c9d10
Upgraded typehints (#2429)
* Future Annotations

* Delete template_twitter_post.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Apply suggestions from code review

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fixed broken RTD

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-20 12:26:21 +08:00

26 lines
720 B
Python

from __future__ import annotations
from manim import *
from manim.utils.testing.frames_comparison import frames_comparison
__module_test__ = "numbers"
@frames_comparison(last_frame=False)
def test_set_value_with_updaters(scene):
"""Test that the position of the decimal updates properly"""
decimal = DecimalNumber(
0,
show_ellipsis=True,
num_decimal_places=3,
include_sign=True,
)
square = Square().to_edge(UP)
decimal.add_updater(lambda d: d.next_to(square, RIGHT))
decimal.add_updater(lambda d: d.set_value(square.get_center()[1]))
scene.add(square, decimal)
scene.play(
square.animate.to_edge(DOWN),
rate_func=there_and_back,
)