From 7231e1cf5b3e728525e322263588fce7f3a1163b Mon Sep 17 00:00:00 2001 From: Julian Stirling Date: Mon, 4 Aug 2025 22:44:40 +0000 Subject: [PATCH] Apply suggestions from code review of branch camera-and-bg-detect-setting-customisation --- src/openflexure_microscope_server/background_detect.py | 7 ++++++- tests/test_cameras.py | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/openflexure_microscope_server/background_detect.py b/src/openflexure_microscope_server/background_detect.py index 4941054f..d9e39e15 100644 --- a/src/openflexure_microscope_server/background_detect.py +++ b/src/openflexure_microscope_server/background_detect.py @@ -33,13 +33,18 @@ class BackgroundDetectorStatus(BaseModel): need different initialisation. """ settings: dict[str, Any] - """The settings for this this background detect Algorithm. These are a dictionary + """The settings for the current background detect Algorithm. These are a dictionary dumped from the base model.""" # Setting schema is a dict until LabThings FastAPI issue #154 is fixed and # DataSchema can be used directly. For now `model_dump()` must be used to dump schema # to a dict. settings_schema: dict[str, Any] + """The schema for the settings for the current background detect Algorithm. + + This is reported so that the UI can dynamically create a UI for any background detector + algorithm. + """ class BackgroundDetectAlgorithm: diff --git a/tests/test_cameras.py b/tests/test_cameras.py index f498d082..2960bc36 100644 --- a/tests/test_cameras.py +++ b/tests/test_cameras.py @@ -74,12 +74,12 @@ def _get_clean_camera_description(camera_thing): def test_thing_description_equivalence(mock_picam_thing): - """Ensure extra actions and properties are not added to camera Things without explicit approval. + """Ensure the built-in camera Thing subclasses retain consistent core functionality. This test verifies that extra actions are not unintentionally introduced to camera child classes. Any addition of actions must be accompanied by an update - to this test, prompting review and justification for why the action does not - belong to the general base class. + to this test, prompting discussion of whether the action belongs in the subclass + or the base camera class. """ base_td = BaseCamera().thing_description() base_actions = set(base_td.actions.keys())