manim/tests/module/utils
Rafael Brusiquesi Martins cfb5c684b7
Add unit tests for module-level color helpers in manim/utils/color/core.py (#4749)
* Add unit tests for module-level color helpers in manim/utils/color/core.py

Adds tests/module/utils/test_color_helpers.py covering the standalone
helper functions exported from manim.utils.color.core (color_to_rgb,
color_to_rgba, color_to_int_rgb, color_to_int_rgba, rgb_to_color,
rgba_to_color, rgb_to_hex, hex_to_rgb, invert_color, color_gradient,
interpolate_color, average_color, random_bright_color, random_color)
and the RandomColorGenerator class.

Before this PR, only the ManimColor class itself was tested
(via tests/module/utils/test_manim_color.py); the standalone helpers
had zero direct test coverage. Coverage on manim/utils/color/core.py
goes from 71% to 80% (line+branch), and 17 of the 18 testable symbols
in the file's __all__ are now exercised. The only deferred symbol is
get_shaded_rgb, which concerns lighting math rather than color
conversion and is better suited to a follow-up.

42 tests, ~0.3s runtime, no new dependencies.

Co-authored-by: LetMarq <LetMarq@users.noreply.github.com>

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

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

* Update tests/module/utils/test_color_helpers.py

Increased assertion scheme to cover all colors.

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

---------

Co-authored-by: THE-RAF <THE-RAF@users.noreply.github.com>
Co-authored-by: LetMarq <LetMarq@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-05-29 17:23:28 -04:00
..
_split_matrices.py Created and optimized Bézier splitting functions such as partial_bezier_points() in manim.utils.bezier (#3766) 2024-05-21 05:26:59 +00:00
_subdivision_matrices.py Created and optimized Bézier splitting functions such as partial_bezier_points() in manim.utils.bezier (#3766) 2024-05-21 05:26:59 +00:00
test_bezier.py Fix of ImageMobject opacity bug (#4089) 2025-01-19 16:56:47 +01:00
test_color.py Add __hash__ to ManimColor (#4051) 2025-01-19 18:09:26 +01:00
test_color_helpers.py Add unit tests for module-level color helpers in manim/utils/color/core.py (#4749) 2026-05-29 17:23:28 -04:00
test_deprecation.py Standardize docstrings with ruff pydocstyle rules (#3881) 2024-09-01 08:03:38 -04:00
test_file_ops.py Migrate more os.path to pathlib in tests (#2991) 2022-10-26 19:51:38 +02:00
test_hashing.py Refactor tests (#2866) 2022-07-09 21:10:30 +00:00
test_manim_color.py Bugfix: HSL color ordering in ManimColor (#4202) 2025-04-21 01:46:59 +00:00
test_space_ops.py Replace legacy numpy usage ruff rule NPY002 (#4516) 2026-01-13 17:23:34 +01:00
test_tex.py Fixed Tex environment doubling braces (#4159) 2025-02-09 11:56:59 -05:00
test_units.py Change from tempconfig to a config fixture in tests (#3853) 2024-07-12 22:41:51 +02:00