8
8
from opentrons_shared_data .errors .exceptions import PipetteOverpressureError
9
9
10
10
from opentrons .types import Point
11
- from opentrons .protocol_engine .execution import PipettingHandler , GantryMover
11
+ from opentrons .protocol_engine .execution import (
12
+ PipettingHandler ,
13
+ GantryMover ,
14
+ MovementHandler ,
15
+ )
12
16
13
17
from opentrons .protocol_engine .commands .command import SuccessData , DefinedErrorData
14
18
from opentrons .protocol_engine .commands .dispense_while_tracking import (
@@ -36,6 +40,7 @@ def subject(
36
40
pipetting : PipettingHandler ,
37
41
state_view : StateView ,
38
42
gantry_mover : GantryMover ,
43
+ movement : MovementHandler ,
39
44
model_utils : ModelUtils ,
40
45
) -> DispenseWhileTrackingImplementation :
41
46
"""Build a command implementation."""
@@ -44,20 +49,27 @@ def subject(
44
49
state_view = state_view ,
45
50
gantry_mover = gantry_mover ,
46
51
model_utils = model_utils ,
52
+ movement = movement ,
47
53
)
48
54
49
55
56
+ @pytest .fixture
57
+ def movement (decoy : Decoy ) -> MovementHandler :
58
+ """Get a mock in the shape of a MovementHandler."""
59
+ return decoy .mock (cls = MovementHandler )
60
+
61
+
50
62
@pytest .mark .parametrize (
51
63
"location,stateupdateLabware,stateupdateWell" ,
52
64
[
53
65
(
54
66
CurrentWell (
55
67
pipette_id = "pipette-id-abc" ,
56
- labware_id = "labware-id-1 " ,
57
- well_name = "well-name-1 " ,
68
+ labware_id = "funky-labware " ,
69
+ well_name = "funky-well " ,
58
70
),
59
- "labware-id-1 " ,
60
- "well-name-1 " ,
71
+ "funky-labware " ,
72
+ "funky-well " ,
61
73
),
62
74
(
63
75
CurrentAddressableArea ("pipette-id-abc" , "addressable-area-1" ),
@@ -124,6 +136,25 @@ async def test_dispense_while_tracking_implementation(
124
136
decoy .when (await gantry_mover .get_position ("pipette-id-abc" )).then_return (
125
137
Point (1 , 2 , 3 )
126
138
)
139
+ _well_location = LiquidHandlingWellLocation (
140
+ origin = WellOrigin .MENISCUS , offset = WellOffset (x = 0.0 , y = 0.0 , z = 1.0 )
141
+ )
142
+ _current_well = CurrentWell (
143
+ pipette_id = "pipette-id-abc" , labware_id = "funky-labware" , well_name = "funky-well"
144
+ )
145
+ decoy .when (
146
+ await subject ._movement .move_to_well (
147
+ pipette_id = "pipette-id-abc" ,
148
+ labware_id = "funky-labware" ,
149
+ well_name = "funky-well" ,
150
+ well_location = _well_location ,
151
+ current_well = _current_well ,
152
+ force_direct = False ,
153
+ minimum_z_height = None ,
154
+ speed = None ,
155
+ operation_volume = - 123.0 ,
156
+ ),
157
+ ).then_return (Point (x = 4 , y = 5 , z = 6 ))
127
158
128
159
result = await subject .execute (data )
129
160
@@ -162,11 +193,11 @@ async def test_dispense_while_tracking_implementation(
162
193
(
163
194
CurrentWell (
164
195
pipette_id = "pipette-id" ,
165
- labware_id = "labware-id-1 " ,
166
- well_name = "well-name-1 " ,
196
+ labware_id = "funky-labware " ,
197
+ well_name = "funky-well " ,
167
198
),
168
- "labware-id-1 " ,
169
- "well-name-1 " ,
199
+ "funky-labware " ,
200
+ "funky-well " ,
170
201
),
171
202
(
172
203
CurrentAddressableArea ("pipette-id" , "addressable-area-1" ),
@@ -237,6 +268,26 @@ async def test_overpressure_error(
237
268
decoy .when (await gantry_mover .get_position (pipette_id )).then_return (position )
238
269
decoy .when (state_view .pipettes .get_current_location ()).then_return (location )
239
270
271
+ _well_location = LiquidHandlingWellLocation (
272
+ origin = WellOrigin .MENISCUS , offset = WellOffset (x = 0.0 , y = 0.0 , z = 1.0 )
273
+ )
274
+ _current_well = CurrentWell (
275
+ pipette_id = "pipette-id" , labware_id = "funky-labware" , well_name = "funky-well"
276
+ )
277
+ decoy .when (
278
+ await subject ._movement .move_to_well (
279
+ pipette_id = "pipette-id" ,
280
+ labware_id = "funky-labware" ,
281
+ well_name = "funky-well" ,
282
+ well_location = _well_location ,
283
+ current_well = _current_well ,
284
+ force_direct = False ,
285
+ minimum_z_height = None ,
286
+ speed = None ,
287
+ operation_volume = - 50.0 ,
288
+ ),
289
+ ).then_return (Point (x = 4 , y = 5 , z = 6 ))
290
+
240
291
result = await subject .execute (data )
241
292
242
293
if isinstance (location , CurrentWell ):
0 commit comments