From ff74d2b86bdc780fd739213960962c6b25df2c89 Mon Sep 17 00:00:00 2001 From: Abigail Emery Date: Thu, 23 May 2024 16:58:37 +0100 Subject: [PATCH] Fixed syntax --- src/ophyd_async/plan_stubs/fly.py | 5 ++--- tests/plan_stubs/test_fly.py | 5 ++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ophyd_async/plan_stubs/fly.py b/src/ophyd_async/plan_stubs/fly.py index 0ae5365b04..5bb41ce44a 100644 --- a/src/ophyd_async/plan_stubs/fly.py +++ b/src/ophyd_async/plan_stubs/fly.py @@ -32,9 +32,8 @@ def time_resolved_fly_and_collect_with_static_seq_table( stages/unstages the devices, and opens and closes the run. """ - # Ensure there is at least on detector - if len(detectors) == 0: - raise ValueError + if not detectors: + raise ValueError("No detectors provided. There must be at least one.") # Set up scan and prepare trigger deadtime = max(det.controller.get_deadtime(exposure) for det in detectors) diff --git a/tests/plan_stubs/test_fly.py b/tests/plan_stubs/test_fly.py index 928a1e76e7..44e04df654 100644 --- a/tests/plan_stubs/test_fly.py +++ b/tests/plan_stubs/test_fly.py @@ -359,6 +359,8 @@ async def test_at_least_one_detector_in_fly_plan( exposure = 1 shutter_time = 0.004 + assert not detector_list + def fly(): yield from time_resolved_fly_and_collect_with_static_seq_table( stream_name="stream1", @@ -369,5 +371,6 @@ def fly(): shutter_time=shutter_time, ) - with pytest.raises(ValueError): + with pytest.raises(ValueError) as exc: RE(fly()) + assert(str(exc)=="No detectors provided. There must be at least one.")