Skip to content

refactor: split mask tests into granular focused tests#232

Merged
Jammy2211 merged 1 commit intomainfrom
feature/refactor-mask-tests
Mar 10, 2026
Merged

refactor: split mask tests into granular focused tests#232
Jammy2211 merged 1 commit intomainfrom
feature/refactor-mask-tests

Conversation

@Jammy2211
Copy link
Owner

Summary

  • test_mask_1d.py: 5 tests → 9 tests. constructor split into 3 scenario-specific tests. is_all_true and is_all_false each converted to @pytest.mark.parametrize covering all 4 cases.
  • test_mask_2d.py: 18 tests → 40 tests. Key changes:
    • constructor split into scalar pixel scale vs anisotropic+origin
    • all_false split into normal and invert=True variants
    • circular, circular_annular, elliptical, elliptical_annular each split into standard and invert=True tests
    • from_pixel_coordinates split into 3 tests (no buffer, buffer=1 single coord, buffer=1 two coords)
    • mask_centre split into 6 directional tests (symmetric, x-offset, y-offset, negative-x, negative-y, diagonal)
    • shape_native_masked_pixels parametrized over 3 mask shapes
    • resized_from parametrized over 2 target shapes
    • is_circular parametrized; circular_radius parametrized

Test plan

  • python -m pytest test_autoarray/mask/ -v — all tests should pass
  • Verify mask_centre directional tests and parametrized tests appear correctly

🤖 Generated with Claude Code

Split monolithic test functions across both mask test files into individual
focused tests, one assertion-group per test. Applied @pytest.mark.parametrize
for is_all_true, is_all_false, shape_native_masked_pixels, resized_from,
from_fits resized shape, is_circular, and circular_radius to eliminate
repeated setup blocks.

Changes per file:
- test_mask_1d.py: 5 tests → 9 tests; constructor split into 3 scenarios;
  is_all_true and is_all_false each converted to parametrize (4 cases each)
- test_mask_2d.py: 18 tests → 40 tests; constructor split into 2 scenarios;
  all_false split into normal/inverted; circular/annular/elliptical/
  elliptical_annular each split into normal and invert=True variants;
  from_pixel_coordinates split into 3 cases by buffer; mask_centre split
  into 6 directional tests; shape_native_masked_pixels parametrized over
  3 shapes; resized_from parametrized; is_circular/circular_radius parametrized

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Jammy2211 Jammy2211 merged commit c519aac into main Mar 10, 2026
8 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.

1 participant