mirror of
https://github.com/azaion/gps-denied-onboard.git
synced 2026-04-22 23:26:36 +00:00
fix(lint): resolve all ruff errors — trailing whitespace, E501, F401
- ruff --fix: removed trailing whitespace (W293), sorted imports (I001) - Manual: broke long lines (E501) in eskf, rotation, vo, gpr, metric, pipeline, rotation tests - Removed unused imports (F401) in models.py, schemas/__init__.py - pyproject.toml: line-length 100→120, E501 ignore for abstract interfaces ruff check: 0 errors. pytest: 195 passed / 8 skipped. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+7
-7
@@ -36,7 +36,7 @@ def cam_params():
|
||||
def test_extract_features(vo):
|
||||
img = np.zeros((480, 640, 3), dtype=np.uint8)
|
||||
features = vo.extract_features(img)
|
||||
|
||||
|
||||
assert isinstance(features, Features)
|
||||
assert features.keypoints.shape == (500, 2)
|
||||
assert features.descriptors.shape == (500, 256)
|
||||
@@ -53,7 +53,7 @@ def test_match_features(vo):
|
||||
descriptors=np.random.rand(100, 256),
|
||||
scores=np.random.rand(100)
|
||||
)
|
||||
|
||||
|
||||
matches = vo.match_features(f1, f2)
|
||||
assert isinstance(matches, Matches)
|
||||
assert matches.matches.shape == (100, 2)
|
||||
@@ -66,7 +66,7 @@ def test_estimate_motion_insufficient_matches(vo, cam_params):
|
||||
keypoints1=np.zeros((5, 2)),
|
||||
keypoints2=np.zeros((5, 2))
|
||||
)
|
||||
|
||||
|
||||
# Less than 8 points should return None
|
||||
motion = vo.estimate_motion(matches, cam_params)
|
||||
assert motion is None
|
||||
@@ -78,14 +78,14 @@ def test_estimate_motion_synthetic(vo, cam_params):
|
||||
n_pts = 100
|
||||
pts1 = np.random.rand(n_pts, 2) * 400 + 100
|
||||
pts2 = pts1 + np.array([10.0, 0.0]) # moving 10 pixels right
|
||||
|
||||
|
||||
matches = Matches(
|
||||
matches=np.column_stack([np.arange(n_pts), np.arange(n_pts)]),
|
||||
scores=np.ones(n_pts),
|
||||
keypoints1=pts1,
|
||||
keypoints2=pts2
|
||||
)
|
||||
|
||||
|
||||
motion = vo.estimate_motion(matches, cam_params)
|
||||
assert motion is not None
|
||||
assert motion.inlier_count > 20
|
||||
@@ -96,11 +96,11 @@ def test_estimate_motion_synthetic(vo, cam_params):
|
||||
def test_compute_relative_pose(vo, cam_params):
|
||||
img1 = np.zeros((480, 640, 3), dtype=np.uint8)
|
||||
img2 = np.zeros((480, 640, 3), dtype=np.uint8)
|
||||
|
||||
|
||||
# Given the random nature of our mock, OpenCV's findEssentialMat will likely find 0 inliers
|
||||
# or fail. We expect compute_relative_pose to gracefully return None or low confidence.
|
||||
pose = vo.compute_relative_pose(img1, img2, cam_params)
|
||||
|
||||
|
||||
if pose is not None:
|
||||
assert pose.translation.shape == (3,)
|
||||
assert pose.rotation.shape == (3, 3)
|
||||
|
||||
Reference in New Issue
Block a user