From 20f61430aa34d8e3469c7f013a9ebbe8cf2eeda1 Mon Sep 17 00:00:00 2001 From: ahmedk <karim.ahmed@xfel.eu> Date: Fri, 29 Sep 2023 16:09:14 +0200 Subject: [PATCH] add tests --- tests/test_jungfraulib.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/test_jungfraulib.py b/tests/test_jungfraulib.py index eb7580ad7..bff2e7643 100644 --- a/tests/test_jungfraulib.py +++ b/tests/test_jungfraulib.py @@ -1,7 +1,7 @@ import pytest from extra_data import RunDirectory -from cal_tools.jungfraulib import JungfrauCtrl +from cal_tools.jungfraulib import JungfrauCtrl, validate_dark_runs # TODO: replace with mocked RAW data as in tests/test_agipdlib.py JF = JungfrauCtrl( @@ -45,3 +45,22 @@ def test_get_gain_setting(settings, result): def test_get_gain_mode(mode, result): JF.run_mode = mode assert JF.get_gain_mode() == result + +@pytest.mark.parametrize( + 'original_runs,sorted_runs', + [ + ([9035, 9036, 9037], [9035, 9036, 9037]), + ([9035, 9037, 9036], [9035, 9036, 9037]), + ([9033, 9032, 9031], [9031, 9032, 9033]), + ([9033, 9031, 9032], [9031, 9032, 9033]), + ] +) +# TODO: missing fixed gain dark runs for JUNGFRAU from test proposal. +# TODO: missing fixed and adaptive runs after the JF control updated. +def test_validate_dark_runs(original_runs, sorted_runs): + raw_folder = "/gpfs/exfel/exp/CALLAB/202130/p900203/raw" + validated_runs = validate_dark_runs( + raw_folder=raw_folder, + runs=original_runs, + ctrl_src="FXE_XAD_JF1M/DET/CONTROL") + assert validated_runs == sorted_runs -- GitLab