manim/tests/module/mobject/test_table.py
Leonardo Cariaggi 1b3390073c
Allow excluding inner lines of Table (#4731)
* Add option to hide/show inner lines in Table class

* Add tests for Table class inner lines visibility

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

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

* Correct indentation

* Fix os.startfile usage to check for availability on Windows

* Add ConversationFlowScene to animate user-chatbot interactions and metadata display

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

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

* Revert "Merge remote-tracking branch 'origin/conversation' into hide_table_inner_lines"

This reverts commit c0ba5b8511, reversing
changes made to 1f71f4b0e8.

* Revert change

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Leonardo Cariaggi <leonardo.cariaggi@kbc.be>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-06-03 09:06:03 -04:00

43 lines
1.2 KiB
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
def test_table_include_inner_lines_false():
"""Verify that inner lines can be disabled while outer lines remain."""
table = Table(
[["A", "B"], ["C", "D"]],
include_outer_lines=True,
include_inner_lines=False,
)
assert len(table.get_horizontal_lines()) == 2
assert len(table.get_vertical_lines()) == 2
def test_table_include_inner_lines_true():
"""Verify that inner lines are present by default."""
table = Table(
[["A", "B"], ["C", "D"]],
include_outer_lines=True,
include_inner_lines=True,
)
assert len(table.get_horizontal_lines()) == 3
assert len(table.get_vertical_lines()) == 3