Skip to content

test: consolidate vlen F-contiguous regression tests#4122

Merged
d-v-b merged 1 commit into
zarr-developers:mainfrom
d-v-b:claude/vlen-f-contiguous-test-cleanup
Jul 6, 2026
Merged

test: consolidate vlen F-contiguous regression tests#4122
d-v-b merged 1 commit into
zarr-developers:mainfrom
d-v-b:claude/vlen-f-contiguous-test-cleanup

Conversation

@d-v-b

@d-v-b d-v-b commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🤖 AI text below 🤖

Follow-up test-quality cleanup for the gh-3558 fix merged in #4116. No source changes — the fix itself is already on main; this only tidies the regression tests it added.

What and why

The test_vlen_string_f_contiguous / test_vlen_bytes_f_contiguous tests added in #4116 had a few issues surfaced in review:

  • The chunks=(2,2) case never exercised the F-contiguous path. With (3,3) data, a (2,2) chunking produces only partial chunks, which _merge_chunk_array recopies into a fresh C-order buffer before the codec sees them — so that parametrization gave false coverage confidence. Only the whole-array (chunks == shape) case actually hands an F-contiguous buffer to the codec. This PR keeps just that case.
  • The F-order input was built indirectly (np.asarray(np.array(...).reshape(3, 3), order="F")), so a future "simplification" dropping the outer np.asarray could silently stop testing the F path. Now it's built directly with reshape((3, 3), order="F") and guarded with assert data.flags.f_contiguous.
  • The two tests were near copy-paste, differing only in dtype/fill_value/data — now one test parametrized over (dtype, fill_value, elements), matching the parametrized style of test_vlen_string in the same file.
  • Added a docstring stating the verified behavior.

Verification

  • pytest tests/test_codecs/test_vlen.py -k f_contiguous → 2 passed (string + bytes).
  • prek run mypy --all-files, ruff check, ruff format --check all pass.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the needs release notes Automatically applied to PRs which haven't added release notes label Jul 6, 2026
Follow-up test-quality cleanup for the zarr-developersgh-3558 fix (zarr-developers#4116):

- Merge test_vlen_string_f_contiguous and test_vlen_bytes_f_contiguous
  into one test parametrized over (dtype, fill_value, elements), matching
  the parametrized style of test_vlen_string in the same file.
- Drop the chunks=(2,2) case: with (3,3) data it produces only partial
  chunks, which the codec pipeline recopies to C order before encoding, so
  it never exercised the F-contiguous path it claimed to cover. Use
  chunks == shape (a single complete chunk) so the F-contiguous buffer
  reaches the codec untouched.
- Build the F-contiguous input directly via reshape(order="F") instead of
  wrapping a C-order reshape in np.asarray(..., order="F"), and assert
  data.flags.f_contiguous so a future simplification can't silently defeat
  the regression guard.
- Add a docstring stating the verified behavior.

Assisted-by: ClaudeCode:claude-opus-4.8
@d-v-b d-v-b force-pushed the claude/vlen-f-contiguous-test-cleanup branch from dcbe087 to 6e93a8b Compare July 6, 2026 09:51
@d-v-b d-v-b marked this pull request as ready for review July 6, 2026 09:54
@d-v-b

d-v-b commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

I'm going to self-merge because this is a small internal cleanup.

@d-v-b d-v-b merged commit a84949a into zarr-developers:main Jul 6, 2026
30 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs release notes Automatically applied to PRs which haven't added release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant