Skip to content

test: 20 tests for naive_median, geometric_median, convert_image_to_ascii#28

Open
hai-pilgrim wants to merge 2 commits intomarksverdhei:mainfrom
hai-pilgrim:test/utils-coverage
Open

test: 20 tests for naive_median, geometric_median, convert_image_to_ascii#28
hai-pilgrim wants to merge 2 commits intomarksverdhei:mainfrom
hai-pilgrim:test/utils-coverage

Conversation

@hai-pilgrim
Copy link
Copy Markdown

Summary

  • Tests for spritegrid/utils.py functions that were previously uncovered
  • naive_median: 1D/2D inputs, odd/even count, single point, symmetric distribution
  • geometric_median: single point, symmetric 1D (returns center), identical points, numpy array return type, collinear convergence bounds, close to naive median on symmetric data
  • convert_image_to_ascii: string return type, fully transparent image → spaces only, ANSI escape codes present for opaque pixels, ascii_space_width multiplier, newlines per row, AssertionError on zero and None width

Test plan

  • 20 tests, all passing: uv run pytest tests/test_utils.py -q

🤖 Generated with Claude Code

marksverdhei and others added 2 commits March 28, 2026 23:33
Adds a --compare CLI flag that outputs a side-by-side comparison image
instead of just the processed result. The after image is upscaled to the
original's dimensions using NEAREST resampling (preserving pixel edges),
then placed alongside the original with "Before" / "After" labels.

  spritegrid input.png --compare -o comparison.png

Comparison is suppressed in debug mode (--debug) and when the image is
already clean pixel art (1:1 detection). Includes 9 unit tests.

Closes marksverdhei#16

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…scii

Covers naive_median (1D/2D, odd/even count, single point, symmetric),
geometric_median (single point, symmetric 1D, identical points, returns
numpy array, collinear convergence, close to naive for symmetric data),
and convert_image_to_ascii (string return, fully transparent → spaces,
ANSI escape codes, ascii_space_width multiplier, newline per row,
AssertionError on invalid width).

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