Skip to content

test: add unit tests for utils/_io.py (lblsave)#1862

Open
wkentaro wants to merge 1 commit intomainfrom
test/utils-io-lblsave
Open

test: add unit tests for utils/_io.py (lblsave)#1862
wkentaro wants to merge 1 commit intomainfrom
test/utils-io-lblsave

Conversation

@wkentaro
Copy link
Owner

@wkentaro wkentaro commented Mar 9, 2026

Summary

lblsave in labelme/utils/_io.py was the only utility function with no dedicated test file. This PR adds tests/unit/utils/_io_test.py with 4 tests covering its full behavior.

Tests Added

  • test_lblsave_valid_uint8_labels — labels in [0, 254] range are saved as a P-mode PNG with a colormap
  • test_lblsave_adds_png_extension — filename without .png extension gets .png appended automatically
  • test_lblsave_invalid_labels_raiseslbl.max() >= 255 raises ValueError
  • test_lblsave_negative_one_labels_oklbl.min() == -1 with lbl.max() < 255 saves successfully

All 4 tests pass. No behavior changes — tests only.

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.

1 participant