Skip to content

chore: Add property testing using hypothesis#122

Merged
qTipTip merged 7 commits into
masterfrom
property-testing
Jun 28, 2026
Merged

chore: Add property testing using hypothesis#122
qTipTip merged 7 commits into
masterfrom
property-testing

Conversation

@qTipTip

@qTipTip qTipTip commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Adding property testing using hypothesis. This PR makes sure that palettes produced by extract_colors maintain some invariants. The property tests also uncovered an issue with extracting colors from images with less pixels than requested colors, when resize was set to False. This has been fixed.

  • add hypothesis as a dev dependency
  • add invariant tests
  • break early if box cannot be split in median cut
  • clamp number of colors to the number of pixels to avoid degenerate cases
  • add a note on frequencies in Palette
  • Add a list of invariants that extract_colors respect
  • update changelog

@qTipTip qTipTip linked an issue Jun 28, 2026 that may be closed by this pull request
@qTipTip qTipTip merged commit e590b1b into master Jun 28, 2026
10 checks passed
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.

Property based testing using hypothesis

1 participant