Skip to content

test: replace swallowed color assertions - #142

Open
RoboX2020 wants to merge 1 commit into
petercorke:mainfrom
RoboX2020:test/color-assertions
Open

RoboX2020 wants to merge 1 commit into
petercorke:mainfrom
RoboX2020:test/color-assertions

Conversation

@RoboX2020

Copy link
Copy Markdown

Addresses the base color test part of #115.

Replace three bare except blocks with checks that can fail:

  • colorname: assert the deprecation warning and the expected red name.
  • ccxyz: use actual wavelength arguments instead of the nonexistent color keyword, check two spectral chromaticities and their normalization, and cover scalar input.
  • colorspace_convert: check known RGB-to-HSV values and the return conversion, rather than just allocating an RGB array.

No production code changes.

Validation on Python 3.11:

  • Color tests: 12 passed, 1 skipped on OpenCV 4.12.0.88 and 5.0.0.93.
  • Full OpenCV 5 suite: 959 passed, 97 skipped, 5 subtests passed.
  • Each rewritten test fails under its corresponding deliberate mutation: wrong color name, zero chromaticities, or skipped conversion. Mutations were restored.

The full suite was not run on OpenCV 4. Existing unrelated unused-import/variable lint findings in this test file remain unchanged. Other #115 files remain separate.

Replace the three protected tests with direct API and value checks.
@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.

This branch has not been deployed

No deployments
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