@@ -25,12 +25,13 @@ def beamline_parameters() -> GDABeamlineParameters:
2525 [0 , 0 , 0 , BeamstopPositions .UNKNOWN ],
2626 [1.52 , 44.78 , 30.0 , BeamstopPositions .DATA_COLLECTION ],
2727 [1.501 , 44.776 , 29.71 , BeamstopPositions .DATA_COLLECTION ],
28+ [1.52 , 42.78 , 29.71 , BeamstopPositions .OUT ],
2829 [1.499 , 44.776 , 29.71 , BeamstopPositions .UNKNOWN ],
2930 [1.501 , 44.774 , 29.71 , BeamstopPositions .UNKNOWN ],
3031 [1.501 , 44.776 , 29.69 , BeamstopPositions .UNKNOWN ],
3132 ],
3233)
33- async def test_beamstop_pos_select (
34+ async def test_beamstop_pos_read_selected_pos (
3435 beamline_parameters : GDABeamlineParameters ,
3536 run_engine : RunEngine ,
3637 x : float ,
@@ -67,8 +68,18 @@ def check_in_beam():
6768 assert data ["beamstop-selected_pos" ] == expected_pos
6869
6970
70- async def test_set_beamstop_position_to_data_collection_moves_beamstop_into_beam (
71- beamline_parameters : GDABeamlineParameters , run_engine : RunEngine
71+ @pytest .mark .parametrize (
72+ "demanded_pos, expected_coords" ,
73+ [
74+ [BeamstopPositions .DATA_COLLECTION , (1.52 , 44.78 , 30.0 )],
75+ [BeamstopPositions .OUT , (1.52 , 42.78 , 30.0 )],
76+ ],
77+ )
78+ async def test_set_beamstop_position_to_data_collection_moves_beamstop (
79+ demanded_pos : BeamstopPositions ,
80+ expected_coords : tuple [float , float , float ],
81+ beamline_parameters : GDABeamlineParameters ,
82+ run_engine : RunEngine ,
7283):
7384 beamstop = Beamstop ("-MO-BS-01:" , beamline_parameters , name = "beamstop" )
7485 await beamstop .connect (mock = True )
@@ -86,13 +97,11 @@ async def test_set_beamstop_position_to_data_collection_moves_beamstop_into_beam
8697 parent_mock .attach_mock (get_mock_put (y_mock ), "beamstop_y" )
8798 parent_mock .attach_mock (get_mock_put (z_mock ), "beamstop_z" )
8899
89- run_engine (
90- bps .abs_set (beamstop .selected_pos , BeamstopPositions .DATA_COLLECTION , wait = True )
91- )
100+ run_engine (bps .abs_set (beamstop .selected_pos , demanded_pos , wait = True ))
92101
93- assert get_mock_put (x_mock ).call_args_list == [call (1.52 , wait = True )]
94- assert get_mock_put (y_mock ).call_args_list == [call (44.78 , wait = True )]
95- assert get_mock_put (z_mock ).call_args_list == [call (30.0 , wait = True )]
102+ assert get_mock_put (x_mock ).call_args_list == [call (expected_coords [ 0 ] , wait = True )]
103+ assert get_mock_put (y_mock ).call_args_list == [call (expected_coords [ 1 ] , wait = True )]
104+ assert get_mock_put (z_mock ).call_args_list == [call (expected_coords [ 2 ] , wait = True )]
96105
97106 assert parent_mock .method_calls [0 ] == call .beamstop_z (30.0 , wait = True )
98107
0 commit comments