Skip to content

test: 17 tests for load_image, handle_txt, handle_png, create_downsampled_image#30

Open
hai-pilgrim wants to merge 1 commit intomarksverdhei:mainfrom
hai-pilgrim:test/main-utils-coverage
Open

test: 17 tests for load_image, handle_txt, handle_png, create_downsampled_image#30
hai-pilgrim wants to merge 1 commit intomarksverdhei:mainfrom
hai-pilgrim:test/main-utils-coverage

Conversation

@hai-pilgrim
Copy link
Copy Markdown

Summary

  • Tests for spritegrid/main.py utility functions (previously uncovered)
  • load_image: local file, missing file → None, URL loading with mocked requests, wrong content-type → None
  • handle_txt: writes content to file, non-.txt extension prints Warning, .txt extension no warning, creates file if not exists
  • handle_png: saves PIL image, prints success message, invalid path doesn't raise (prints Error to stderr)
  • create_downsampled_image: output size matches (num_cells_w, num_cells_h), even kernel raises ValueError, kernel larger than grid raises, zero grid width raises, returns PIL Image, median_type="geometric" works

Test plan

  • 17 tests, all passing: uv run pytest tests/test_main_utils.py -q

🤖 Generated with Claude Code

… handle_png, create_downsampled_image)

load_image: local file, missing file → None, URL with mocked requests,
wrong content-type → None. handle_txt: writes content, non-txt extension
warns, .txt no warning, creates new file. handle_png: saves file, prints
success, invalid path → error to stderr (no raise). create_downsampled_image:
output size, even kernel error, kernel > grid error, zero grid error, PIL
return type, geometric median type.

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