Skip to content
Snippets Groups Projects
Commit 2bb639f5 authored by Karim Ahmed's avatar Karim Ahmed
Browse files

fix assert positions

parent 79cf9be1
No related branches found
No related tags found
1 merge request!905[AGIPD][DARK] Improvements for reading conditions by creating new dataclass for multiple runs
...@@ -10,6 +10,7 @@ SPB_AGIPD_INST_SRC = 'SPB_DET_AGIPD1M-1/DET/0CH0:xtdf' ...@@ -10,6 +10,7 @@ SPB_AGIPD_INST_SRC = 'SPB_DET_AGIPD1M-1/DET/0CH0:xtdf'
SPB_AGIPD_KARABO_CTRL_ID = 'SPB_IRU_AGIPD1M1' SPB_AGIPD_KARABO_CTRL_ID = 'SPB_IRU_AGIPD1M1'
CTRL_SRC = f'{SPB_AGIPD_KARABO_CTRL_ID}/MDL/FPGA_COMP' CTRL_SRC = f'{SPB_AGIPD_KARABO_CTRL_ID}/MDL/FPGA_COMP'
def test_get_acq_rate_ctrl(mock_agipd1m_run): def test_get_acq_rate_ctrl(mock_agipd1m_run):
# Current up to date data with acq_rate stored # Current up to date data with acq_rate stored
# as repetition rate in slow data. # as repetition rate in slow data.
...@@ -225,58 +226,60 @@ ADAPTIVE_CTRL_RUNS = AgipdCtrlRuns( ...@@ -225,58 +226,60 @@ ADAPTIVE_CTRL_RUNS = AgipdCtrlRuns(
ctrl_src=CTRL_SRC, ctrl_src=CTRL_SRC,
) )
@pytest.mark.requires_gpfs @pytest.mark.requires_gpfs
def test_get_memory_cells_runs(): def test_get_memory_cells_runs():
assert 352 == FIXED_CTRL_RUNS.get_memory_cells() assert FIXED_CTRL_RUNS.get_memory_cells() == 352
assert 352 == ADAPTIVE_CTRL_RUNS.get_memory_cells() assert ADAPTIVE_CTRL_RUNS.get_memory_cells() == 352
@pytest.mark.requires_gpfs @pytest.mark.requires_gpfs
def test_get_bias_voltage_runs(): def test_get_bias_voltage_runs():
assert 300 == FIXED_CTRL_RUNS.get_bias_voltage(SPB_AGIPD_KARABO_CTRL_ID) assert FIXED_CTRL_RUNS.get_bias_voltage(SPB_AGIPD_KARABO_CTRL_ID) == 300
assert 300 == ADAPTIVE_CTRL_RUNS.get_bias_voltage(SPB_AGIPD_KARABO_CTRL_ID) assert ADAPTIVE_CTRL_RUNS.get_bias_voltage(SPB_AGIPD_KARABO_CTRL_ID) == 300
@pytest.mark.requires_gpfs @pytest.mark.requires_gpfs
def test_get_integration_time_runs(): def test_get_integration_time_runs():
assert 12 == FIXED_CTRL_RUNS.get_integration_time() assert FIXED_CTRL_RUNS.get_integration_time() == 12
assert 20 == ADAPTIVE_CTRL_RUNS.get_integration_time() assert ADAPTIVE_CTRL_RUNS.get_integration_time() == 20
@pytest.mark.requires_gpfs @pytest.mark.requires_gpfs
def test_get_acquisition_rate_runs(): def test_get_acquisition_rate_runs():
assert 1.1 == FIXED_CTRL_RUNS.get_acq_rate() assert FIXED_CTRL_RUNS.get_acq_rate() == 1.1
assert 1.1 == ADAPTIVE_CTRL_RUNS.get_acq_rate() assert ADAPTIVE_CTRL_RUNS.get_acq_rate() == 1.1
@pytest.mark.requires_gpfs @pytest.mark.requires_gpfs
def test_get_gain_setting_runs(): def test_get_gain_setting_runs():
assert 0 == FIXED_CTRL_RUNS.get_gain_setting() assert FIXED_CTRL_RUNS.get_gain_setting() == 0
assert 0 == ADAPTIVE_CTRL_RUNS.get_gain_setting() assert ADAPTIVE_CTRL_RUNS.get_gain_setting() == 0
@pytest.mark.requires_gpfs @pytest.mark.requires_gpfs
def test_get_gain_mode_runs(): def test_get_gain_mode_runs():
assert [ assert FIXED_CTRL_RUNS.get_gain_modes() == [
AgipdGainMode.FIXED_HIGH_GAIN, AgipdGainMode.FIXED_HIGH_GAIN,
AgipdGainMode.FIXED_MEDIUM_GAIN, AgipdGainMode.FIXED_MEDIUM_GAIN,
AgipdGainMode.FIXED_LOW_GAIN AgipdGainMode.FIXED_LOW_GAIN
] == FIXED_CTRL_RUNS.get_gain_modes() ]
assert [ assert ADAPTIVE_CTRL_RUNS.get_gain_modes() == [
AgipdGainMode.ADAPTIVE_GAIN]*3 == ADAPTIVE_CTRL_RUNS.get_gain_modes() AgipdGainMode.ADAPTIVE_GAIN]*3
@pytest.mark.requires_gpfs @pytest.mark.requires_gpfs
def test_fixed_gain_mode(): def test_fixed_gain_mode():
assert True == FIXED_CTRL_RUNS.fixed_gain_mode() assert FIXED_CTRL_RUNS.fixed_gain_mode()
assert not ADAPTIVE_CTRL_RUNS.fixed_gain_mode()
assert False == ADAPTIVE_CTRL_RUNS.fixed_gain_mode()
@pytest.mark.requires_gpfs @pytest.mark.requires_gpfs
def test_raise_fixed_gain_mode(): def test_raise_fixed_gain_mode():
...@@ -284,11 +287,12 @@ def test_raise_fixed_gain_mode(): ...@@ -284,11 +287,12 @@ def test_raise_fixed_gain_mode():
raw_folder=TEST_RAW_FOLDER, raw_folder=TEST_RAW_FOLDER,
runs=[9011, 9016, 9017], runs=[9011, 9016, 9017],
image_src=SPB_AGIPD_INST_SRC, image_src=SPB_AGIPD_INST_SRC,
ctrl_src=CTRL_SRC, ctrl_src=CTRL_SRC,
) )
with pytest.raises(ValueError) as e: with pytest.raises(ValueError):
adaptive_fixed_ctrls.fixed_gain_mode() adaptive_fixed_ctrls.fixed_gain_mode()
@pytest.mark.requires_gpfs @pytest.mark.requires_gpfs
def test_raise_validate_gain_modes(): def test_raise_validate_gain_modes():
adaptive_fixed_ctrls = AgipdCtrlRuns( adaptive_fixed_ctrls = AgipdCtrlRuns(
...@@ -297,7 +301,7 @@ def test_raise_validate_gain_modes(): ...@@ -297,7 +301,7 @@ def test_raise_validate_gain_modes():
image_src=SPB_AGIPD_INST_SRC, image_src=SPB_AGIPD_INST_SRC,
ctrl_src=CTRL_SRC, ctrl_src=CTRL_SRC,
) )
with pytest.raises(ValueError) as e: with pytest.raises(ValueError):
adaptive_fixed_ctrls.validate_gain_modes() adaptive_fixed_ctrls.validate_gain_modes()
unsorted_fixed_gain_ctrls = AgipdCtrlRuns( unsorted_fixed_gain_ctrls = AgipdCtrlRuns(
...@@ -306,5 +310,5 @@ def test_raise_validate_gain_modes(): ...@@ -306,5 +310,5 @@ def test_raise_validate_gain_modes():
image_src=SPB_AGIPD_INST_SRC, image_src=SPB_AGIPD_INST_SRC,
ctrl_src=CTRL_SRC, ctrl_src=CTRL_SRC,
) )
with pytest.raises(ValueError) as e: with pytest.raises(ValueError):
unsorted_fixed_gain_ctrls.validate_gain_modes() unsorted_fixed_gain_ctrls.validate_gain_modes()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment