Skip to content

test: 29 tests for comfyui/nodes.py (tensor_to_pil, pil_to_tensor, SpriteGrid metadata)#34

Open
hai-pilgrim wants to merge 2 commits into
marksverdhei:mainfrom
hai-pilgrim:test/comfyui-nodes
Open

test: 29 tests for comfyui/nodes.py (tensor_to_pil, pil_to_tensor, SpriteGrid metadata)#34
hai-pilgrim wants to merge 2 commits into
marksverdhei:mainfrom
hai-pilgrim:test/comfyui-nodes

Conversation

@hai-pilgrim
Copy link
Copy Markdown

Summary

  • Tests tensor_to_pil: RGB/RGBA input mode detection, size (h,w) mapping, value scaling 0–1→0–255, black/white edge cases, alpha channel preservation
  • Tests pil_to_tensor: float32 dtype, output shape (1, h, w, 4), RGB→RGBA conversion, values in [0,1], RGBA alpha preservation, h/w dimension order
  • Tests SpriteGrid node metadata: RETURN_TYPES, FUNCTION, CATEGORY, INPUT_TYPES() structure, min_grid/quantize defaults, remove_background choices, crop default
  • Tests NODE_CLASS_MAPPINGS and NODE_DISPLAY_NAME_MAPPINGS dictionaries

No ComfyUI runtime required — tests exercise the pure tensor/image conversion logic and metadata dictionaries only.
Run with uv run --with torch pytest tests/test_comfyui_nodes.py (torch not in project deps but available as a system package).

Test plan

  • All 29 tests pass with uv run --with torch pytest tests/test_comfyui_nodes.py

🤖 Generated with Claude Code

marksverdhei and others added 2 commits March 29, 2026 03:12
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.
…riteGrid metadata)

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