Clean up nanobind typing and source layout

This commit is contained in:
2026-03-27 11:19:53 +08:00
parent 9d63177de0
commit 69e83d8430
19 changed files with 792 additions and 47 deletions
+2 -1
View File
@@ -56,7 +56,7 @@ def test_camera_structure_repr():
[[1, 0, 0], [0, 1, 0], [0, 0, 1]],
[0, 0, 0, 0, 0],
[[1, 0, 0], [0, 1, 0], [0, 0, 1]],
[[1], [2], [3]],
[1, 2, 3],
640,
480,
rpt.CameraModel.PINHOLE,
@@ -65,6 +65,7 @@ def test_camera_structure_repr():
rendered = repr(camera)
assert "Camera 1" in rendered
assert "pinhole" in rendered
np.testing.assert_allclose(np.asarray(camera.T, dtype=np.float32).reshape(3), [1.0, 2.0, 3.0])
@pytest.mark.parametrize(
+18
View File
@@ -0,0 +1,18 @@
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
def test_checked_in_core_stub_exists():
assert (ROOT / "src" / "rpt" / "_core.pyi").exists()
def test_checked_in_core_stub_matches_generated_stub():
generated_stub = ROOT / "build" / "bindings" / "rpt" / "_core.pyi"
if not generated_stub.exists():
pytest.skip("Build-generated nanobind stub is unavailable.")
checked_in_stub = ROOT / "src" / "rpt" / "_core.pyi"
assert checked_in_stub.read_text(encoding="utf-8") == generated_stub.read_text(encoding="utf-8")