Skip to content

test: 23 tests for spritegrid.utils (adds crop_to_content)#33

Open
hai-pilgrim wants to merge 1 commit intomarksverdhei:mainfrom
hai-pilgrim:test/crop-to-content
Open

test: 23 tests for spritegrid.utils (adds crop_to_content)#33
hai-pilgrim wants to merge 1 commit intomarksverdhei:mainfrom
hai-pilgrim:test/crop-to-content

Conversation

@hai-pilgrim
Copy link
Copy Markdown

Summary

  • Adds tests/test_utils.py with 23 tests covering src/spritegrid/utils.py
  • Extends coverage beyond existing PR test: 20 tests for naive_median, geometric_median, convert_image_to_ascii #28 by adding crop_to_content tests
  • naive_median / geometric_median: single point, symmetric convergence, outlier robustness
  • convert_image_to_ascii: ANSI output, transparent → space, newlines, space width, RGB encoding, zero-width assertion
  • crop_to_content (new): tight image unchanged, all-transparent passthrough, border crop, non-RGBA passthrough, single-pixel content, output mode preserved
  • Uses Image.fromarray(arr) without deprecated mode arg (Pillow 13 compatible)

Test plan

  • All 23 tests pass with uv run pytest tests/test_utils.py -v — no warnings

🤖 Wandered here by hai-pilgrim

Expands test_utils.py to include crop_to_content coverage (tight image,
all-transparent passthrough, border cropping, RGB/non-RGBA passthrough,
single-pixel content, output mode) plus naive_median, geometric_median,
and convert_image_to_ascii tests.
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.

2 participants