diff --git a/src/ophyd_async/epics/areadetector/controllers/aravis_controller.py b/src/ophyd_async/epics/areadetector/controllers/aravis_controller.py index 27de15d253..8f4786f395 100644 --- a/src/ophyd_async/epics/areadetector/controllers/aravis_controller.py +++ b/src/ophyd_async/epics/areadetector/controllers/aravis_controller.py @@ -76,7 +76,7 @@ def _get_trigger_info( else: return ( ADAravisTriggerMode.on, - ADAravisTriggerSource(f"line_{self.gpio_number}"), + ADAravisTriggerSource[f"line_{self.gpio_number}"], ) async def disarm(self): diff --git a/tests/epics/areadetector/test_aravis.py b/tests/epics/areadetector/test_aravis.py index af43b86f37..77a2a75dc7 100644 --- a/tests/epics/areadetector/test_aravis.py +++ b/tests/epics/areadetector/test_aravis.py @@ -10,8 +10,14 @@ set_sim_value, ) from ophyd_async.epics.areadetector.aravis import ADAravisDetector -from ophyd_async.epics.areadetector.controllers.aravis_controller import ADAravisController -from ophyd_async.epics.areadetector.drivers.aravis_driver import ADAravisDriver, ADAravisTriggerSource +from ophyd_async.epics.areadetector.controllers.aravis_controller import ( + ADAravisController, +) +from ophyd_async.epics.areadetector.drivers.aravis_driver import ( + ADAravisDriver, + ADAravisTriggerSource, +) + @pytest.fixture async def adaravis_driver(RE: RunEngine) -> ADAravisDriver: @@ -126,9 +132,32 @@ async def test_hints_from_hdf_writer(adaravis: ADAravisDetector): async def test_unsupported_trigger_excepts(adaravis: ADAravisDetector): + set_sim_value(adaravis._controller._drv.model, "Manta G-125") + set_sim_value(adaravis._controller._drv.pixel_format, "Mono12Packed") + with pytest.raises( ValueError, - # str(EnumClass.value) handling changed in Python 3.11 match=r"ADAravisController only supports the following trigger types: .* but", ): await adaravis.prepare(TriggerInfo(1, DetectorTrigger.variable_gate, 1, 1)) + +async def test_unsupported_model_excepts(adaravis: ADAravisDetector): + set_sim_value(adaravis._controller._drv.model, "foo") + set_sim_value(adaravis._controller._drv.pixel_format, "bar") + + with pytest.raises( + AssertionError, + match=r"Detector .* needs at least nans deadtime, but trigger logic provides", + ): + await adaravis.prepare(TriggerInfo(1, DetectorTrigger.variable_gate, 1, 1)) + + +async def test_unsupported_pixel_format_excepts(adaravis: ADAravisDetector): + set_sim_value(adaravis._controller._drv.model, "Manta G-235") + set_sim_value(adaravis._controller._drv.pixel_format, "bar") + + with pytest.raises( + AssertionError, + match=r"Detector .* needs at least nans deadtime, but trigger logic provides", + ): + await adaravis.prepare(TriggerInfo(1, DetectorTrigger.variable_gate, 1, 1)) \ No newline at end of file