Skip to content

Add regression tests for four recent fixes in vectorized_mobject.py#4750

Merged
chopan050 merged 3 commits into
ManimCommunity:mainfrom
THE-RAF:add-regression-tests-for-vectorized-mobject
Jun 2, 2026
Merged

Add regression tests for four recent fixes in vectorized_mobject.py#4750
chopan050 merged 3 commits into
ManimCommunity:mainfrom
THE-RAF:add-regression-tests-for-vectorized-mobject

Conversation

@THE-RAF
Copy link
Copy Markdown
Contributor

@THE-RAF THE-RAF commented May 28, 2026

Closes #4741.

Summary

manim/mobject/types/vectorized_mobject.py is 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:

Fix commit Bug
21cf9998 IndexError in get_nth_subpath when path_list is empty; also: ensure the return value is a NumPy array
f6cdb547 add_points_as_corners silently dropped a single new point when the last subpath was complete
3d029c12 pointwise_become_partial cleared target points when source had no cubic curves — surfaced as Arrow3D.get_start() / get_end() returning origin after Create
429f25328 scale(scale_stroke=True) on a compound VMobject overwrote each submobject's stroke with the parent's scaled stroke

Validation

For each test, the protocol was:

  1. Surgically revert just the buggy line(s) on manim/mobject/types/vectorized_mobject.py.
  2. Run the test — it must fail, with a traceback pointing at the fix's lines.
  3. Restore the fix.
  4. Run the test — it must pass.

All four tests passed step 2 (failed pre-fix with the expected error) and step 4 (passed post-fix). For example, the 21cf9998 test fails on the reverted code with IndexError: list index out of range at the exact [path_list[-1][-1]] * nppcc line the fix replaced.

Test plan

pytest tests/module/mobject/types/vectorized_mobject/ -v --no-cov -p no:xdist -o addopts="" \
    -k "stroke_scale_preserves or align_points_handles or add_points_as_corners_single or pointwise_become_partial_preserves"

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 sibling
  • tests/module/mobject/types/vectorized_mobject/test_stroke.py — one test, next to the existing test_stroke_scale

Each test docstring cites the original fix commit so future maintainers can trace a test back to the bug it guards against.

THE-RAF and others added 3 commits May 28, 2026 18:13
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>
Copy link
Copy Markdown
Member

@chopan050 chopan050 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for these tests!

@chopan050 chopan050 enabled auto-merge (squash) June 2, 2026 21:51
@chopan050 chopan050 merged commit 56f7eb2 into ManimCommunity:main Jun 2, 2026
14 of 15 checks passed
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.

Add regression tests for four recent fixes in vectorized_mobject.py

2 participants