Skip to content

refactor: split structures tests into granular focused tests#231

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

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

Conversation

@Jammy2211
Copy link
Owner

Summary

  • test_uniform_1d.py (arrays): 8 tests → 14 tests. from_fits split by file size (3-element vs 4-element); header info tests split; recursive_shape_storage split by no-mask vs partial-mask.
  • test_uniform_2d.py (arrays): 17 tests → 33 tests. constructor split into 4 scenarios (all-false mask, partial mask 1D values, partial mask 2D values, store_native=True). resized_from parametrized over 2 target shapes. padded_before_convolution_from and trimmed_after_convolution_from parametrized over kernel sizes, with the larger-array variant as a separate test. binned_across_rows/columns split into 3 tests each. brightest_coordinate split into 4 tests.
  • test_uniform_1d.py (grids): 8 tests → 12 tests. Constructor, no_mask, from_mask, uniform, uniform_from_zero all split by scenario.
  • test_uniform_2d.py (grids): 21 tests → 24 tests. Constructor exception split into too-many/too-few cases. no_mask split by origin. uniform split into 3 scenarios. bounding_box split into 2 tests; buffer variant split into 2 tests.

Test plan

  • python -m pytest test_autoarray/structures/ -v — all tests should pass
  • Verify parametrized tests appear with [shape0]/[shape1] suffixes in output

🤖 Generated with Claude Code

Split monolithic test functions in the arrays and grids test files into
individual focused tests. Each test now has a name that encodes the input
condition and expected outcome, so failures identify the exact scenario.
Applied @pytest.mark.parametrize where the same logic runs over multiple
equivalent inputs (resize shapes, kernel sizes for pad/trim).

Changes per file:
- test_uniform_1d.py (arrays): 8 tests → 14 tests; from_fits and header
  tests split by file size; recursive_shape_storage split by mask presence
- test_uniform_2d.py (arrays): 17 tests → 33 tests; constructor split into
  4 cases; resized_from parametrized over 2 shapes; padded/trimmed_from
  parametrized over kernel sizes; binned and brightest tests split by scenario
- test_uniform_1d.py (grids): 8 tests → 12 tests; constructor, no_mask,
  from_mask, uniform, uniform_from_zero, and grid_2d_radial split
- test_uniform_2d.py (grids): 21 tests → 24 tests; constructor exception
  split into too-many/too-few; no_mask and uniform split by scenario;
  bounding_box tests split with/without buffer variant

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Jammy2211 Jammy2211 merged commit c28230d 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