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
Open
test: 29 tests for comfyui/nodes.py (tensor_to_pil, pil_to_tensor, SpriteGrid metadata)#34hai-pilgrim wants to merge 2 commits into
hai-pilgrim wants to merge 2 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tensor_to_pil: RGB/RGBA input mode detection, size (h,w) mapping, value scaling 0–1→0–255, black/white edge cases, alpha channel preservationpil_to_tensor: float32 dtype, output shape(1, h, w, 4), RGB→RGBA conversion, values in [0,1], RGBA alpha preservation, h/w dimension orderSpriteGridnode metadata:RETURN_TYPES,FUNCTION,CATEGORY,INPUT_TYPES()structure,min_grid/quantizedefaults,remove_backgroundchoices,cropdefaultNODE_CLASS_MAPPINGSandNODE_DISPLAY_NAME_MAPPINGSdictionariesNo 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
uv run --with torch pytest tests/test_comfyui_nodes.py🤖 Generated with Claude Code