test: remove bare except from point-feature and core-op tests - #114
Merged
Merged
Conversation
A bare 'except: pass' also swallows the AssertionError from assertGreater, so these tests could never fail. Several also called APIs that do not exist, so they had never tested anything: - img.SURF(): never implemented (see #113); now an explicit skip with reason - img.corners(): the real method is Harris() - sift.uv: the real attributes are u, v, p - img.concat(): the real methods are Image.Hstack/Vstack (note sep=1 default) - img.getpixel(): the real method is pixel(u, v) - img.interp2d(1-D, 1-D): needs (Ho, Wo) coordinate arrays Rewritten against the real API with direct assertions, using .array rather than the deprecated .A. Verified on OpenCV 4.14 and 5.0 (20 passed, 1 skipped), and by deliberately breaking SIFT/ORB/Harris/pixel/Hstack to confirm each test now fails. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | -17 |
| Duplication | 0 |
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 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
Closes #51.
A bare
except: passalso swallows theAssertionErrorraised byassertGreater, so these tests could never fail. On inspection several never tested anything because they called APIs that don't exist:test_surfImage.SURF()never existed (and SURF is non-free in pip OpenCV)@unittest.skippointing at #113test_cornersImage.corners()test_harris, usesImage.Harris()test_feature_properties.uvu,v,p,strengthtest_concatImage.concat()test_hstack/test_vstack(Hstack/Vstack, notesep=1default)test_get_pixelgetpixel()pixel(u, v), checks (u,v) = (col,row) ordertest_interp2d(Ho, Wo)arraystest_sift,test_orb,test_features_list_operations, write/read, colorspace, castAlso uses
.arrayinstead of the deprecated.A. Test-only change; no library code touched.Verification
tests/test_image_point_features.py→ 20 passed, 1 skipped (SURF) on both.SIFT,ORB,Harris,pixelandHstack(raising, and returning empty/wrong results) — every one now fails its test. The old tests missed all of them.Follow-ups (not in this PR)
Image.SURF(), or drop it from the docs.except:pattern remains intests/test_camera.py(10+ sites) and someexcept Exception: ... passblocks elsewhere.Checklist
🤖 Generated with Claude Code