Skip to content

fix: report valid color lookup values clearly - #138

Merged
petercorke merged 3 commits into
petercorke:mainfrom
RoboX2020:fix/color-lookup-errors
Oct 17, 2026
Merged

petercorke merged 3 commits into
petercorke:mainfrom
RoboX2020:fix/color-lookup-errors

Conversation

@RoboX2020

Copy link
Copy Markdown
Contributor

Addresses the color.py lookup-message part of #115.

The white-point and primary-name lookups now catch KeyError rather than every exception. Their ValueError messages list the supported names with commas, instead of using the entire sentence as a separator. The original KeyError remains available as the cause.

Added two regression tests checking the exact messages and exception causes. Both tests fail against the original implementation.

Validation on Python 3.11 / OpenCV 5.0.0.93:

  • Full pytest suite: 961 passed, 97 skipped, 5 subtests passed.
  • Color tests: 14 passed, 1 skipped.
  • New test file passes ruff and black; changed source passes black.

OpenCV 4 was not run for this PR. The other exception sites in #115 are left unchanged.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@petercorke
petercorke merged commit 637a787 into petercorke:main Oct 17, 2026
39 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 17, 2026
@petercorke

Copy link
Copy Markdown
Owner

Welcome to MVTB! Thanks for your contributions here and in RTB and bdsim. This is a lovely contribution: the old ", ".join(...) was using the whole sentence as the separator, which made the error message nonsense, and your tests pin the exact wording and the exception cause. Merged, and thanks for taking the time, it's much appreciated.

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