Skip to content

Commit

Permalink
tests: move test of camera functionality into separate camera test
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasNeugebauer committed Feb 5, 2025
1 parent d572c54 commit ce6a30e
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions tests/test_cameras.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from rosys.vision import (
CalibratableCamera,
Calibration,
Camera,
ConfigurableCamera,
MjpegCamera,
RtspCamera,
Expand Down Expand Up @@ -60,6 +61,21 @@ async def test_rtsp_camera(rosys_integration):
assert len(camera.images) >= 1


async def test_storing_camera_as_dict(rosys_integration):
camera = Camera(id='test_cam',
name='T3:5T',
connect_after_init=False,
base_path_overwrite='test_cam',
image_history_length=10)
await camera.connect()
camera_as_dict = camera.to_dict()
restored_camera = Camera.from_dict(camera_as_dict)
assert isinstance(restored_camera, Camera)
assert restored_camera.name == camera.name
assert restored_camera.base_path == camera.base_path
assert restored_camera.images.maxlen == camera.images.maxlen


async def test_storing_simulated_camera_as_dict(rosys_integration):
camera = SimulatedCamera(id='test_cam', name='T3:5T', connect_after_init=False,
width=808, height=606, color='#010101', fps=1)
Expand All @@ -76,7 +92,7 @@ async def test_storing_simulated_camera_as_dict(rosys_integration):

async def test_storing_configurable_camera_as_dict(rosys_integration):
camera = ConfigurableCamera(id='test_cam', name='T3:5T', connect_after_init=False,
base_path_overwrite='test_cam', image_history_length=10)
base_path_overwrite='test_cam')
await camera.connect()
camera_as_dict = camera.to_dict()
restored_camera = ConfigurableCamera.from_dict(camera_as_dict)
Expand All @@ -86,7 +102,6 @@ async def test_storing_configurable_camera_as_dict(rosys_integration):
assert restored_camera.parameters == camera.parameters
assert restored_camera.connect_after_init == camera.connect_after_init
assert restored_camera.base_path == camera.base_path
assert restored_camera.images.maxlen == camera.images.maxlen


def test_storing_transformable_camera_as_dict(rosys_integration):
Expand Down

0 comments on commit ce6a30e

Please sign in to comment.