Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): allow aspirate/dispense at arbitrary locations #11352

Merged
merged 3 commits into from
Aug 17, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 31 additions & 8 deletions api/tests/opentrons/protocols/api_support/test_instrument.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest import mock

import pytest
from opentrons.protocol_api import ProtocolContext
from opentrons.protocol_api.labware import Well
from opentrons.protocols.api_support.instrument import (
determine_drop_target,
Expand Down Expand Up @@ -54,23 +55,45 @@ def test_determine_drop_target(api_version, expected_point):
assert r.point == expected_point


def test_validate_validate_takes_liquid(ctx):
@pytest.mark.parametrize("reject_module", [True, False])
def test_validate_takes_liquid(ctx: ProtocolContext, reject_module: bool) -> None:
well_plate = ctx.load_labware("corning_96_wellplate_360ul_flat", 1)
tip_rack = ctx.load_labware("opentrons_96_tiprack_300ul", 2)

validate_takes_liquid(Location(Point(1, 2, 3), None), False)
validate_takes_liquid(Location(Point(1, 2, 3), well_plate), False)
validate_takes_liquid(Location(Point(1, 2, 3), well_plate.wells()[0]), False)
validate_takes_liquid(well_plate.wells()[0].top(), False)
validate_takes_liquid(
location=Location(Point(1, 2, 3), None),
reject_module=reject_module,
)
validate_takes_liquid(
location=Location(Point(1, 2, 3), well_plate),
reject_module=reject_module,
)
validate_takes_liquid(
location=Location(Point(1, 2, 3), well_plate.wells()[0]),
reject_module=reject_module,
)
validate_takes_liquid(
location=well_plate.wells()[0].top(),
reject_module=reject_module,
)

with pytest.raises(ValueError, match="Cannot aspirate/dispense to a tip rack"):
validate_takes_liquid(Location(Point(1, 2, 3), tip_rack), False)
validate_takes_liquid(
location=Location(Point(1, 2, 3), tip_rack),
reject_module=reject_module,
)

with pytest.raises(ValueError, match="Cannot aspirate/dispense to a tip rack"):
validate_takes_liquid(Location(Point(1, 2, 3), tip_rack.wells()[0]), False)
validate_takes_liquid(
location=Location(Point(1, 2, 3), tip_rack.wells()[0]),
reject_module=reject_module,
)

with pytest.raises(ValueError, match="Cannot aspirate/dispense to a tip rack"):
validate_takes_liquid(tip_rack.wells_by_name()["A1"].top(), False)
validate_takes_liquid(
location=tip_rack.wells_by_name()["A1"].top(),
reject_module=reject_module,
)


def test_validate_validate_takes_liquid_module_location(ctx):
mcous marked this conversation as resolved.
Show resolved Hide resolved
Expand Down