Skip to content

Use dynamic class name in CurvesAsSubmobjects error messages - #5011

Open
webzuweb wants to merge 2 commits into
ManimCommunity:mainfrom
webzuweb:fix/curves-as-submobjects-dynamic-class-name
Open

webzuweb wants to merge 2 commits into
ManimCommunity:mainfrom
webzuweb:fix/curves-as-submobjects-dynamic-class-name

Conversation

@webzuweb

Copy link
Copy Markdown

Summary

Fixes #4983.

The two error messages in _throw_error_if_no_submobjects and _get_submobjects_with_points hardcoded the string "CurvesAsSubmobjects". This PR uses type(self).__name__ so the message automatically reflects any subclass and stays correct if the class is ever renamed (matching the existing pattern in Mobject.throw_error_if_no_points).

Changes

  • manim/mobject/types/vectorized_mobject.py: replace the hardcoded class name with cls = type(self).__name__ in both error messages.
  • tests/module/mobject/types/vectorized_mobject/test_vectorized_mobject.py: added test_curves_as_submobjects_error_message_uses_dynamic_class_name, which subclasses CurvesAsSubmobjects and asserts the error reports the subclass name and no longer contains the hardcoded string.

Test

pytest tests/module/mobject/types/vectorized_mobject/test_vectorized_mobject.py::test_curves_as_submobjects_point_from_proportion tests/module/mobject/types/vectorized_mobject/test_vectorized_mobject.py::test_curves_as_submobjects_error_message_uses_dynamic_class_name

2 passed.

webzuweb and others added 2 commits September 11, 2026 14:08
The two error messages in _throw_error_if_no_submobjects and
_get_submobjects_with_points hardcoded the string
"CurvesAsSubmobjects". Use type(self).__name__ so the message
automatically reflects subclasses and stays correct if the class is
ever renamed.

Fixes ManimCommunity#4983
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CurvesAsSubmobjects error messages contain hardcoded class names

1 participant