Skip to content

Commit

Permalink
Updated pressure cell unit tests and lint fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
barnettwilliam authored and stan-dot committed Feb 7, 2025
1 parent ebe526f commit 6c70538
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/dodal/beamlines/p38.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def high_pressure_xray_cell(
return device_instantiation(
PressureJumpCell,
"high_pressure_xray_cell",
f"-EA",
"-EA",
wait_for_connection,
fake_with_ophyd_sim,
cell_prefix="-HPXC-01:",
Expand Down
8 changes: 6 additions & 2 deletions src/dodal/devices/pressure_jump_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ def __init__(self, prefix: str, name: str = "") -> None:

super().__init__(name)

def set(self, request: FastValveControlRequest | ValveOpenSeqRequest) -> AsyncStatus:
def set(
self, request: FastValveControlRequest | ValveOpenSeqRequest
) -> AsyncStatus:
set_status = None

if isinstance(request, FastValveControlRequest):
Expand Down Expand Up @@ -229,7 +231,9 @@ def __init__(
self.omron_pressure = epics_signal_r(
float, f"{final_prefix}PP{transducer_number}:PRES"
)
self.omron_voltage = epics_signal_r(float, f"{final_prefix}PP{transducer_number}:RAW")
self.omron_voltage = epics_signal_r(
float, f"{final_prefix}PP{transducer_number}:RAW"
)
self.beckhoff_pressure = epics_signal_r(
float, f"{final_prefix}STATP{transducer_number}:MeanValue_RBV"
)
Expand Down
33 changes: 19 additions & 14 deletions tests/devices/unit_tests/test_pressure_jump_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ async def test_reading_pjumpcell_includes_config_fields_valves(
cell.all_valves_control.valve_control[3].close, ValveControlRequest.OPEN
)
set_mock_value(
cell.all_valves_control.valve_control[1].open, ValveOpenSeqRequest.INACTIVE
cell.all_valves_control.valve_control[1].open,
ValveOpenSeqRequest.INACTIVE.value,
)
set_mock_value(
cell.all_valves_control.valve_control[3].open, ValveOpenSeqRequest.OPEN_SEQ
cell.all_valves_control.valve_control[3].open,
ValveOpenSeqRequest.OPEN_SEQ.value,
)

set_mock_value(
Expand All @@ -89,22 +91,23 @@ async def test_reading_pjumpcell_includes_config_fields_valves(
)
set_mock_value(
cell.all_valves_control.fast_valve_control[5].open,
ValveOpenSeqRequest.INACTIVE,
ValveOpenSeqRequest.INACTIVE.value,
)
set_mock_value(
cell.all_valves_control.fast_valve_control[6].open, ValveOpenSeqRequest.OPEN_SEQ
cell.all_valves_control.fast_valve_control[6].open,
ValveOpenSeqRequest.OPEN_SEQ.value,
)

await assert_reading(
cell.all_valves_control.valve_control[1],
{
"pjump-all_valves_control-valve_control-1-close": {
"value": ValveControlRequest.CLOSE,
"pjump-all_valves_control-valve_control-1-open": {
"value": int(ValveOpenSeqRequest.INACTIVE.value),
"timestamp": ANY,
"alarm_severity": 0,
},
"pjump-all_valves_control-valve_control-1-open": {
"value": ValveOpenSeqRequest.INACTIVE,
"pjump-all_valves_control-valve_control-1-close": {
"value": ValveControlRequest.CLOSE,
"timestamp": ANY,
"alarm_severity": 0,
},
Expand All @@ -120,7 +123,8 @@ async def test_pjumpcell_set_valve_sets_valve_fields(
cell.all_valves_control.valve_control[1].close, ValveControlRequest.RESET
)
set_mock_value(
cell.all_valves_control.valve_control[1].open, ValveOpenSeqRequest.INACTIVE
cell.all_valves_control.valve_control[1].open,
ValveOpenSeqRequest.INACTIVE.value,
)

set_mock_value(
Expand All @@ -129,7 +133,8 @@ async def test_pjumpcell_set_valve_sets_valve_fields(
)

set_mock_value(
cell.all_valves_control.fast_valve_control[6].open, ValveOpenSeqRequest.INACTIVE
cell.all_valves_control.fast_valve_control[6].open,
ValveOpenSeqRequest.INACTIVE.value,
)

# Set new values
Expand All @@ -146,7 +151,7 @@ async def test_pjumpcell_set_valve_sets_valve_fields(
cell.all_valves_control.valve_control[1],
{
"pjump-all_valves_control-valve_control-1-open": {
"value": ValveOpenSeqRequest.OPEN_SEQ,
"value": int(ValveOpenSeqRequest.OPEN_SEQ.value),
"timestamp": ANY,
"alarm_severity": 0,
},
Expand All @@ -161,7 +166,7 @@ async def test_pjumpcell_set_valve_sets_valve_fields(
cell.all_valves_control.fast_valve_control[6],
{
"pjump-all_valves_control-fast_valve_control-6-open": {
"value": ValveOpenSeqRequest.OPEN_SEQ,
"value": int(ValveOpenSeqRequest.OPEN_SEQ.value),
"timestamp": ANY,
"alarm_severity": 0,
},
Expand All @@ -180,7 +185,7 @@ async def test_pjumpcell_set_valve_sets_valve_fields(
cell.all_valves_control.valve_control[1],
{
"pjump-all_valves_control-valve_control-1-open": {
"value": ValveOpenSeqRequest.INACTIVE,
"value": int(ValveOpenSeqRequest.INACTIVE.value),
"timestamp": ANY,
"alarm_severity": 0,
},
Expand All @@ -203,7 +208,7 @@ async def test_pjumpcell_set_valve_sets_valve_fields(
"alarm_severity": 0,
},
"pjump-all_valves_control-fast_valve_control-6-open": {
"value": ValveOpenSeqRequest.INACTIVE,
"value": int(ValveOpenSeqRequest.INACTIVE.value),
"timestamp": ANY,
"alarm_severity": 0,
},
Expand Down

0 comments on commit 6c70538

Please sign in to comment.