Skip to content

Commit

Permalink
more text changes and test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sanni-t committed Dec 12, 2023
1 parent 080c154 commit 1c55458
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
18 changes: 9 additions & 9 deletions api/src/opentrons/protocol_api/core/engine/deck_conflict.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, message: str) -> None:
)


class PipetteMovementNotAllowed(MotionPlanningFailureError):
class UnsuitableTiprackForPipetteMotion(MotionPlanningFailureError):
"""Error raised when trying to perform a pipette movement to a tip rack, based on adapter status."""

def __init__(self, message: str) -> None:
Expand Down Expand Up @@ -209,28 +209,28 @@ def check_safe_for_tip_pickup_and_return(
return

is_partial_config = engine_state.pipettes.get_is_partially_configured(pipette_id)
tiprack_name = engine_state.labware.get_load_name(labware_id)
tiprack_name = engine_state.labware.get_display_name(labware_id)
tiprack_parent = engine_state.labware.get_location(labware_id)
if isinstance(tiprack_parent, OnLabwareLocation): # tiprack is on an adapter
tiprack_height = engine_state.labware.get_dimensions(labware_id).z
adapter_height = engine_state.labware.get_dimensions(tiprack_parent.labwareId).z
if is_partial_config and tiprack_height < adapter_height:
raise PartialTipMovementNotAllowedError(
f"Tip rack {tiprack_name} cannot be on an adapter taller than the tip rack"
f"{tiprack_name} cannot be on an adapter taller than the tip rack"
f" when picking up fewer than 96 tips."
)
elif not is_partial_config and tiprack_height > adapter_height:
raise PipetteMovementNotAllowed(
f"Tip rack {tiprack_name} must be on an Opentrons Flex 96 Tip Rack Adapter"
f" in order to pick up or return 96 tips simultaneously."
raise UnsuitableTiprackForPipetteMotion(
f"{tiprack_name} must be on an Opentrons Flex 96 Tip Rack Adapter"
f" in order to pick up or return all 96 tips simultaneously."
)

elif (
not is_partial_config
): # tiprack is not on adapter and pipette is in full config
raise PipetteMovementNotAllowed(
f"Tiprack {tiprack_name} must be on a Flex Tiprack Adapter (or similar)"
f" in order to pick up or return tips with all 96-channel nozzles."
raise UnsuitableTiprackForPipetteMotion(
f"{tiprack_name} must be on an Opentrons Flex 96 Tip Rack Adapter"
f" in order to pick up or return all 96 tips simultaneously."
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,8 @@ def test_deck_conflict_raises_for_bad_partial_8_channel_move(
Dimensions(x=0, y=0, z=50),
False,
pytest.raises(
deck_conflict.PipetteMovementNotAllowed,
match="must be on a Flex Tiprack Adapter",
deck_conflict.UnsuitableTiprackForPipetteMotion,
match="A cool tiprack must be on an Opentrons Flex 96 Tip Rack Adapter",
),
),
(
Expand All @@ -505,8 +505,8 @@ def test_deck_conflict_raises_for_bad_partial_8_channel_move(
Dimensions(x=0, y=0, z=101),
False,
pytest.raises(
deck_conflict.PipetteMovementNotAllowed,
match="must be on a Flex Tiprack Adapter",
deck_conflict.UnsuitableTiprackForPipetteMotion,
match="A cool tiprack must be on an Opentrons Flex 96 Tip Rack Adapter",
),
),
(
Expand All @@ -515,7 +515,7 @@ def test_deck_conflict_raises_for_bad_partial_8_channel_move(
True,
pytest.raises(
deck_conflict.PartialTipMovementNotAllowedError,
match="cannot be on an adapter taller than the tiprack",
match="A cool tiprack cannot be on an adapter taller than the tip rack",
),
),
(
Expand Down Expand Up @@ -545,7 +545,9 @@ def test_valid_96_pipette_movement_for_tiprack_and_adapter(
decoy.when(mock_state_view.labware.get_dimensions("adapter-id")).then_return(
Dimensions(x=0, y=0, z=100)
)

decoy.when(mock_state_view.labware.get_display_name("labware-id")).then_return(
"A cool tiprack"
)
decoy.when(
mock_state_view.pipettes.get_is_partially_configured("pipette-id")
).then_return(is_partial_config)
Expand Down

0 comments on commit 1c55458

Please sign in to comment.