From d4a6cf0f30ac41cd10a6514301573e2897ca2578 Mon Sep 17 00:00:00 2001 From: esmithExperimentControls Date: Fri, 22 Nov 2024 13:28:42 +0000 Subject: [PATCH] Add tests to cover case of missing tof in dimensions of bounds parameter for tof_bounded_spectra and wavelength_bounded_spectra --- tests/devices/simpledae/test_reducers.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/devices/simpledae/test_reducers.py b/tests/devices/simpledae/test_reducers.py index 7549f66..198e935 100644 --- a/tests/devices/simpledae/test_reducers.py +++ b/tests/devices/simpledae/test_reducers.py @@ -911,3 +911,15 @@ async def test_monitor_normalizer_det_sum_wavelength_mon_sum_wavelength( # 3, 3 def test_tof_bounded_spectra_bounds_missing_or_too_many(data: list[float]): with pytest.raises(expected_exception=ValueError, match="Should contain lower and upper bound"): tof_bounded_spectra(sc.array(dims=["tof"], values=data, unit=sc.units.us)) + + +def test_tof_bounded_spectra_missing_tof_in_bounds_dims(): + with pytest.raises(expected_exception=ValueError): + tof_bounded_spectra(sc.array(dims=[""], values=[0], unit=sc.units.us)) + + +def test_wavelength_bounded_spectra_missing_tof_in_bounds_dims(): + with pytest.raises(expected_exception=ValueError): + wavelength_bounded_spectra( + bounds=sc.array(dims=[""], values=[0], unit=sc.units.us), beam_total=sc.scalar(value=0) + )