Add regression tests for four recent fixes in vectorized_mobject.py#4750
Merged
chopan050 merged 3 commits intoJun 2, 2026
Merged
Conversation
Adds four regression tests for fixes that landed without tests in the same PR: * 21cf999 (PR ManimCommunity#4630, fixes ManimCommunity#3569 + ManimCommunity#4629) -- IndexError in `get_nth_subpath` when `path_list` is empty; ensure it always returns a NumPy array. * f6cdb54 (PR ManimCommunity#4219) -- `add_points_as_corners` silently dropped a single new point when called on a VMobject whose last subpath was complete. * 3d029c1 (PR ManimCommunity#4320, fixes ManimCommunity#4255) -- `pointwise_become_partial` cleared the target's points when the source had no cubic curves, surfacing as `Arrow3D.get_start()` / `get_end()` returning the origin after a `Create` animation. * 429f253 (PR ManimCommunity#4694) -- `scale(scale_stroke=True)` on a compound VMobject propagated the parent's scaled stroke width to every submobject, overwriting submobjects with their own (e.g. zero) stroke. Each test reproduces the original failing condition at the unit level and asserts the post-fix behavior. Validation: every test was confirmed to fail when the corresponding fix is reverted on the source file, and pass when the fix is restored. 4 tests, ~0.2s runtime. Tests go in the existing files `tests/module/mobject/types/vectorized_mobject/test_vectorized_mobject.py` (three tests, adjacent to their topically-related siblings) and `tests/module/mobject/types/vectorized_mobject/test_stroke.py` (one test, next to the existing `test_stroke_scale`). Co-authored-by: LetMarq <LetMarq@users.noreply.github.com>
for more information, see https://pre-commit.ci
chopan050
approved these changes
Jun 2, 2026
Member
chopan050
left a comment
There was a problem hiding this comment.
LGTM! Thanks for these tests!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4741.
Summary
manim/mobject/types/vectorized_mobject.pyis one of the more frequently-touched files in the repo — 18+ commits since 2024-01-01, including several bug fixes that landed without regression tests in the same PR. The bugs are gone, but nothing in the test suite checks they don't come back.This PR adds one focused regression test per fix for the four most recent untested fixes in the file:
21cf9998IndexErroringet_nth_subpathwhenpath_listis empty; also: ensure the return value is a NumPy arrayf6cdb547add_points_as_cornerssilently dropped a single new point when the last subpath was complete3d029c12pointwise_become_partialcleared target points when source had no cubic curves — surfaced asArrow3D.get_start()/get_end()returning origin afterCreate429f25328scale(scale_stroke=True)on a compound VMobject overwrote each submobject's stroke with the parent's scaled strokeValidation
For each test, the protocol was:
manim/mobject/types/vectorized_mobject.py.All four tests passed step 2 (failed pre-fix with the expected error) and step 4 (passed post-fix). For example, the
21cf9998test fails on the reverted code withIndexError: list index out of rangeat the exact[path_list[-1][-1]] * nppccline the fix replaced.Test plan
Expected: 4 passed in ~0.2s.
File layout
Tests are added to existing test modules — no new files:
tests/module/mobject/types/vectorized_mobject/test_vectorized_mobject.py— three tests, each placed next to its topically-related siblingtests/module/mobject/types/vectorized_mobject/test_stroke.py— one test, next to the existingtest_stroke_scaleEach test docstring cites the original fix commit so future maintainers can trace a test back to the bug it guards against.