|
3 | 3 | from decoy import Decoy
|
4 | 4 | from mock import AsyncMock, patch
|
5 | 5 |
|
6 |
| -from typing import Dict, ContextManager, Optional |
| 6 | +from typing import Dict, ContextManager, Optional, OrderedDict |
7 | 7 | from contextlib import nullcontext as does_not_raise
|
8 | 8 |
|
9 |
| -from opentrons.types import Mount, MountType |
| 9 | +from opentrons.types import Mount, MountType, Point |
10 | 10 | from opentrons.hardware_control import API as HardwareAPI
|
11 | 11 | from opentrons.hardware_control.types import TipStateType
|
12 | 12 | from opentrons.hardware_control.protocols.types import OT2RobotType, FlexRobotType
|
|
25 | 25 | VirtualTipHandler,
|
26 | 26 | create_tip_handler,
|
27 | 27 | )
|
| 28 | +from opentrons.hardware_control.nozzle_manager import NozzleMap |
| 29 | +from opentrons_shared_data.pipette.pipette_definition import ValidNozzleMaps |
28 | 30 |
|
29 | 31 |
|
30 | 32 | @pytest.fixture
|
@@ -53,6 +55,17 @@ def tip_rack_definition() -> LabwareDefinition:
|
53 | 55 | return LabwareDefinition.construct(namespace="test", version=42) # type: ignore[call-arg]
|
54 | 56 |
|
55 | 57 |
|
| 58 | +MOCK_MAP = NozzleMap.build( |
| 59 | + physical_nozzles=OrderedDict({"A1": Point(0, 0, 0)}), |
| 60 | + physical_rows=OrderedDict({"A": ["A1"]}), |
| 61 | + physical_columns=OrderedDict({"1": ["A1"]}), |
| 62 | + starting_nozzle="A1", |
| 63 | + back_left_nozzle="A1", |
| 64 | + front_right_nozzle="A1", |
| 65 | + valid_nozzle_maps=ValidNozzleMaps(maps={"Full": ["A1"]}), |
| 66 | +) |
| 67 | + |
| 68 | + |
56 | 69 | async def test_create_tip_handler(
|
57 | 70 | decoy: Decoy,
|
58 | 71 | mock_state_view: StateView,
|
@@ -102,6 +115,9 @@ async def test_flex_pick_up_tip_state(
|
102 | 115 | decoy.when(mock_state_view.pipettes.get_mount("pipette-id")).then_return(
|
103 | 116 | MountType.LEFT
|
104 | 117 | )
|
| 118 | + decoy.when(mock_state_view.pipettes.state.nozzle_configuration_by_id).then_return( |
| 119 | + {"pipette-id": MOCK_MAP} |
| 120 | + ) |
105 | 121 | decoy.when(
|
106 | 122 | mock_state_view.geometry.get_nominal_tip_geometry(
|
107 | 123 | pipette_id="pipette-id",
|
@@ -171,6 +187,10 @@ async def test_pick_up_tip(
|
171 | 187 | MountType.LEFT
|
172 | 188 | )
|
173 | 189 |
|
| 190 | + decoy.when(mock_state_view.pipettes.state.nozzle_configuration_by_id).then_return( |
| 191 | + {"pipette-id": MOCK_MAP} |
| 192 | + ) |
| 193 | + |
174 | 194 | decoy.when(
|
175 | 195 | mock_state_view.geometry.get_nominal_tip_geometry(
|
176 | 196 | pipette_id="pipette-id",
|
@@ -225,6 +245,9 @@ async def test_drop_tip(
|
225 | 245 | decoy.when(mock_state_view.pipettes.get_mount("pipette-id")).then_return(
|
226 | 246 | MountType.RIGHT
|
227 | 247 | )
|
| 248 | + decoy.when(mock_state_view.pipettes.state.nozzle_configuration_by_id).then_return( |
| 249 | + {"pipette-id": MOCK_MAP} |
| 250 | + ) |
228 | 251 |
|
229 | 252 | await subject.drop_tip(pipette_id="pipette-id", home_after=True)
|
230 | 253 |
|
@@ -499,6 +522,11 @@ async def test_verify_tip_presence_on_ot3(
|
499 | 522 | decoy.when(mock_state_view.pipettes.get_mount("pipette-id")).then_return(
|
500 | 523 | MountType.LEFT
|
501 | 524 | )
|
| 525 | + |
| 526 | + decoy.when( |
| 527 | + mock_state_view.pipettes.state.nozzle_configuration_by_id |
| 528 | + ).then_return({"pipette-id": MOCK_MAP}) |
| 529 | + |
502 | 530 | await subject.verify_tip_presence("pipette-id", expected, None)
|
503 | 531 |
|
504 | 532 | decoy.verify(
|
|
0 commit comments