11import sys
2+ from typing import TypedDict
23from pathlib import Path
34
45import numpy as np
89sys .path .insert (0 , str (REPO_ROOT / "python" ))
910sys .path .insert (0 , str (REPO_ROOT / "extensions/rcs_zed/src" ))
1011
11- from rcs_zed .camera import ZEDCameraSet , ZEDDeviceInfo , ZEDFrameBundle
12+ from rcs_zed .camera import ZEDCameraSet , ZEDDeviceInfo , ZEDFrameBundle # noqa: E402
1213
13- from rcs import common
14+ from rcs import common # noqa: E402
1415
1516
1617class FakeOpenedZEDCamera :
@@ -27,14 +28,20 @@ def close(self):
2728 self .closed = True
2829
2930
31+ class PatchZedState (TypedDict ):
32+ devices : dict [str , ZEDDeviceInfo ]
33+ opened : dict [str , FakeOpenedZEDCamera ]
34+ open_calls : list [tuple [str , bool , bool ]]
35+
36+
3037@pytest .fixture ()
31- def patch_zed (monkeypatch ):
32- state : dict [ str , object ] = {"devices" : {}, "opened" : {}, "open_calls" : []}
38+ def patch_zed (monkeypatch ) -> PatchZedState :
39+ state : PatchZedState = {"devices" : {}, "opened" : {}, "open_calls" : []}
3340
34- def fake_enumerate (cls ):
41+ def fake_enumerate (_cls ):
3542 return state ["devices" ]
3643
37- def fake_open (cls , config : common .BaseCameraConfig , * , enable_depth : bool , enable_imu : bool ):
44+ def fake_open (_cls , config : common .BaseCameraConfig , * , enable_depth : bool , enable_imu : bool ):
3845 state ["open_calls" ].append ((config .identifier , enable_depth , enable_imu ))
3946 return state ["opened" ][config .identifier ]
4047
@@ -69,6 +76,7 @@ def test_zed_frame_mapping_depth_scaling_and_imu_downgrade(patch_zed):
6976 )
7077 camera_set .open ()
7178 frame = camera_set .poll_frame ("wrist" )
79+ assert frame .camera .color .intrinsics is not None
7280
7381 assert patch_zed ["open_calls" ] == [("123" , True , False )]
7482 assert np .array_equal (frame .camera .color .data , color )
0 commit comments