fix: resolve basedpyright errors in aruco and tests

This commit is contained in:
2026-02-07 09:00:07 +00:00
parent 4fc8de4bdc
commit 8f6aee7f22
4 changed files with 59 additions and 46 deletions
+6 -5
View File
@@ -18,14 +18,14 @@ def test_compute_face_normal_valid_quad():
# normal = [1, 0, 0] x [0, 1, 0] = [0, 0, 1]
normal = compute_face_normal(corners)
np.testing.assert_allclose(normal, [0, 0, 1], atol=1e-10)
np.testing.assert_allclose(normal, np.array([0, 0, 1]), atol=1e-10)
def test_compute_face_normal_valid_triangle():
corners = np.array([[0, 0, 0], [1, 0, 0], [0, 1, 0]], dtype=np.float64)
normal = compute_face_normal(corners)
np.testing.assert_allclose(normal, [0, 0, 1], atol=1e-10)
np.testing.assert_allclose(normal, np.array([0, 0, 1]), atol=1e-10)
def test_compute_face_normal_degenerate():
@@ -104,7 +104,8 @@ def test_get_face_normal_from_geometry():
}
normal = get_face_normal_from_geometry("top", marker_geometry, face_marker_map)
np.testing.assert_allclose(normal, [0, 0, 1], atol=1e-10)
assert normal is not None
np.testing.assert_allclose(normal, np.array([0, 0, 1]), atol=1e-10)
# Missing face map
assert get_face_normal_from_geometry("top", marker_geometry, None) is None
@@ -145,14 +146,14 @@ def test_detect_ground_face():
assert res is not None
face_name, normal = res
assert face_name == "bottom"
np.testing.assert_allclose(normal, [0, -1, 0], atol=1e-10)
np.testing.assert_allclose(normal, np.array([0, -1, 0]), atol=1e-10)
# Only top visible
res = detect_ground_face({2}, marker_geometry, camera_up, face_marker_map)
assert res is not None
face_name, normal = res
assert face_name == "top"
np.testing.assert_allclose(normal, [0, 1, 0], atol=1e-10)
np.testing.assert_allclose(normal, np.array([0, 1, 0]), atol=1e-10)
# None visible
assert (
@@ -64,10 +64,10 @@ def test_pool_size_1_equivalence(mock_dependencies):
# Run with pool_size=1
apply_depth_verify_refine_postprocess(
results=results,
verification_frames=verification_frames,
results=results, # type: ignore
verification_frames=verification_frames, # pyright: ignore
marker_geometry=marker_geometry,
camera_matrices=camera_matrices,
camera_matrices=camera_matrices, # pyright: ignore
verify_depth=True,
refine_depth=False,
use_confidence_weights=False,
@@ -122,10 +122,10 @@ def test_pool_size_5_integration(mock_dependencies):
# Run with pool_size=3
apply_depth_verify_refine_postprocess(
results=results,
verification_frames=verification_frames,
results=results, # type: ignore
verification_frames=verification_frames, # pyright: ignore
marker_geometry=marker_geometry,
camera_matrices=camera_matrices,
camera_matrices=camera_matrices, # pyright: ignore
verify_depth=True,
refine_depth=False,
use_confidence_weights=False,
@@ -148,8 +148,8 @@ def test_pool_size_5_integration(mock_dependencies):
# Verify metadata was added
assert "depth_pool" in results[serial]
assert results[serial]["depth_pool"]["pooled"] is True
assert results[serial]["depth_pool"]["pool_size_actual"] == 3
assert results[serial]["depth_pool"]["pooled"] is True # pyright: ignore
assert results[serial]["depth_pool"]["pool_size_actual"] == 3 # pyright: ignore
def test_pool_fallback_insufficient_valid(mock_dependencies):
@@ -222,10 +222,10 @@ def test_pool_fallback_insufficient_valid(mock_dependencies):
camera_matrices = {serial: np.eye(3)}
apply_depth_verify_refine_postprocess(
results=results,
verification_frames=verification_frames,
results=results, # type: ignore
verification_frames=verification_frames, # pyright: ignore
marker_geometry=marker_geometry,
camera_matrices=camera_matrices,
camera_matrices=camera_matrices, # pyright: ignore
verify_depth=True,
refine_depth=False,
use_confidence_weights=False,
@@ -246,8 +246,8 @@ def test_pool_fallback_insufficient_valid(mock_dependencies):
assert passed_depth_map is d1
# Verify metadata
assert results[serial]["depth_pool"]["pooled"] is False
assert results[serial]["depth_pool"]["pooled"] is False # pyright: ignore
assert (
results[serial]["depth_pool"]["fallback_reason"]
results[serial]["depth_pool"]["fallback_reason"] # pyright: ignore
== "insufficient_valid_points"
)