Skip to content

Commit

Permalink
fix tests and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Laura-Danielle committed Jul 17, 2024
1 parent 0e207c7 commit 41332b9
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 22 deletions.
43 changes: 28 additions & 15 deletions api/tests/opentrons/protocol_api/core/engine/test_deck_conflict.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,23 +467,10 @@ def test_maps_trash_bins(
),
pytest.raises(
deck_conflict.PartialTipMovementNotAllowedError,
match="collision with items in staging slot C4",
match="will result in collision with items in staging slot C4.",
),
170,
),
( # Collision with robot
(
Point(x=150, y=150, z=40),
Point(x=250, y=101, z=40),
Point(x=150, y=101, z=40),
Point(x=250, y=150, z=40),
),
pytest.raises(
deck_conflict.PartialTipMovementNotAllowedError,
match="is outside of robot bounds for the pipette.",
),
700,
),
],
)
def test_deck_conflict_raises_for_bad_pipette_move(
Expand Down Expand Up @@ -639,7 +626,7 @@ def test_deck_conflict_raises_for_collision_with_tc_lid(
destination_well_point = Point(x=123, y=123, z=123)
pipette_bounds_at_destination = (
Point(x=50, y=350, z=204.5),
Point(x=150, y=450, z=204.5),
Point(x=150, y=429, z=204.5),
Point(x=150, y=400, z=204.5),
Point(x=50, y=300, z=204.5),
)
Expand All @@ -666,6 +653,32 @@ def test_deck_conflict_raises_for_collision_with_tc_lid(
pipette_id="pipette-id", destination_position=destination_well_point
)
).then_return(pipette_bounds_at_destination)
decoy.when(mock_state_view.pipettes.get_mount("pipette-id")).then_return(
MountType.LEFT
)
decoy.when(
mock_state_view.pipettes.get_pipette_bounding_box("pipette-id")
).then_return(
# 96 chan outer bounds
PipetteBoundingBoxOffsets(
back_left_corner=Point(-67.0, -3.5, -259.15),
front_right_corner=Point(94.0, -113.0, -259.15),
front_left_corner=Point(-67.0, -113.0, -259.15),
back_right_corner=Point(94.0, -3.5, -259.15),
)
)
decoy.when(mock_state_view.geometry.absolute_deck_extents).then_return(
_AbsoluteRobotExtents(
front_left={
MountType.LEFT: Point(13.5, 60.5, 0.0),
MountType.RIGHT: Point(-40.5, 60.5, 0.0),
},
back_right={
MountType.LEFT: Point(463.7, 433.3, 0.0),
MountType.RIGHT: Point(517.7, 433.3),
},
)
)

decoy.when(
adjacent_slots_getters.get_surrounding_slots(5, robot_type="OT-3 Standard")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest

from opentrons import simulate
from opentrons.protocol_api import COLUMN, ALL
from opentrons.protocol_api import COLUMN, ALL, SINGLE
from opentrons.protocol_api.core.engine.deck_conflict import (
PartialTipMovementNotAllowedError,
)
Expand Down Expand Up @@ -113,7 +113,7 @@ def test_deck_conflicts_for_96_ch_a12_column_configuration() -> None:
@pytest.mark.ot3_only
def test_close_shave_deck_conflicts_for_96_ch_a12_column_configuration() -> None:
"""Shouldn't raise errors for "almost collision"s."""
protocol_context = simulate.get_protocol_api(version="2.16", robot_type="Flex")
protocol_context = simulate.get_protocol_api(version="2.20", robot_type="Flex")
res12 = protocol_context.load_labware("nest_12_reservoir_15ml", "C3")

# Mag block and tiprack adapter are very close to the destination reservoir labware
Expand All @@ -129,13 +129,14 @@ def test_close_shave_deck_conflicts_for_96_ch_a12_column_configuration() -> None
deepwell = hs_adapter.load_labware("nest_96_wellplate_2ml_deep")
protocol_context.load_trash_bin("A3")
p1000_96 = protocol_context.load_instrument("flex_96channel_1000")
p1000_96.configure_nozzle_layout(style=COLUMN, start="A12", tip_racks=[tiprack_8])
p1000_96.configure_nozzle_layout(style=SINGLE, start="A12", tip_racks=[tiprack_8])

hs.close_labware_latch() # type: ignore[union-attr]
# Note
p1000_96.distribute(
15,
res12.wells()[0],
deepwell.rows()[0],
res12["A6"],
deepwell.columns()[6],
disposal_vol=0,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ def test_deck_configuration_setting(
deck_type=DeckType.OT3_STANDARD,
),
deck_definition=ot3_standard_deck_def,
robot_definition={
"displayName": "OT-3",
"robotType": "OT-3 Standard",
"models": ["OT-3 Standard"],
"extents": [477.2, 493.8, 0.0],
"mountOffsets": {
"left": [-13.5, -60.5, 255.675],
"right": [40.5, -60.5, 255.675],
"gripper": [84.55, -12.75, 93.85],
},
},
)
subject_view = AddressableAreaView(subject.state)

Expand Down
2 changes: 1 addition & 1 deletion shared-data/python/opentrons_shared_data/deck/dev_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This should only be imported if typing.TYPE_CHECKING is True
"""

from typing import Any, Dict, List, NewType, Union, Optional
from typing import Any, Dict, List, NewType, Union
from typing_extensions import Literal, TypedDict

from ..module.dev_types import ModuleType
Expand Down
4 changes: 3 additions & 1 deletion shared-data/python/opentrons_shared_data/robot/dev_types.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""opentrons_shared_data.robot.dev_types: types for robot def."""
import enum
from typing import NewType, List, Dict, Any, Optional
from typing import NewType, List, Dict, Any
from typing_extensions import Literal, TypedDict, NotRequired

RobotSchemaVersion1 = Literal[1]
Expand Down Expand Up @@ -30,6 +30,8 @@ def robot_literal_to_enum(cls, robot_type: RobotType) -> "RobotTypeEnum":


class mountOffset(TypedDict):
"""The mount offsets for a given robot type based off the center of the carriage.."""

left: List[float]
right: List[float]
gripper: NotRequired[List[float]]
Expand Down

0 comments on commit 41332b9

Please sign in to comment.