mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
* fix: infinite recursion caused by accessing color of a highlighted Table cell. fix: removed type: ignore[attr-defined] mypy was not a fan of * fix: added back needed mypy type ignore * Add regression tests for Table/BackgroundRectangle color access Tests for infinite recursion issue fixed in PR #4435 (issue #4419). Refs: #4419 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Refactor BackgroundRectangle color test to geometry tests Move test_background_rectangle_color from test_table.py to test_unit_geometry.py since BackgroundRectangle lives in geometry/shape_matchers.py, not in tables. Regression test for ManimCommunity/manim#4419 (infinite recursion when accessing BackgroundRectangle.color) * Fix: Added missing manim GREEN import needed for test_BackgroundRectangle_color_access() --------- Co-authored-by: Henrik Skov Midtiby <hemi@mmmi.sdu.dk> Co-authored-by: Benjamin Hackl <mail@behackl.dev> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: bhearr <None>
19 lines
569 B
Python
19 lines
569 B
Python
"""Tests for Table and related mobjects."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from manim import Table
|
|
from manim.utils.color import GREEN
|
|
|
|
|
|
def test_highlighted_cell_color_access():
|
|
"""Test that accessing the color of a highlighted cell doesn't cause infinite recursion.
|
|
|
|
Regression test for https://github.com/ManimCommunity/manim/issues/4419
|
|
"""
|
|
table = Table([["This", "is a"], ["simple", "table"]])
|
|
rect = table.get_highlighted_cell((1, 1), color=GREEN)
|
|
|
|
# Should not raise RecursionError
|
|
color = rect.color
|
|
assert color == GREEN
|