Skip to content

Commit daa51dd

Browse files
fix(api): Filter out air_gap() calls as higher-order commands (#14985)
1 parent ce97b91 commit daa51dd

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

api/src/opentrons/protocol_runner/legacy_command_mapper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def __init__(self, wrapping_exc: BaseException) -> None:
7979
legacy_command_types.DISTRIBUTE,
8080
legacy_command_types.TRANSFER,
8181
legacy_command_types.RETURN_TIP,
82+
legacy_command_types.AIR_GAP,
8283
}
8384

8485

api/tests/opentrons/protocol_runner/smoke_tests/test_legacy_command_mapper.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""
66
from datetime import datetime
77
from pathlib import Path
8+
from textwrap import dedent
89
from typing import List
910

1011
import pytest
@@ -753,3 +754,46 @@ async def test_zero_volume_dispense_commands(
753754
labwareId=load_well_plate.result.labwareId,
754755
wellName="D7",
755756
)
757+
758+
759+
async def test_air_gap(tmp_path: Path) -> None:
760+
"""An `air_gap()` should be mapped to an `aspirate`.
761+
762+
This covers RQA-2621.
763+
"""
764+
path = tmp_path / "protocol.py"
765+
path.write_text(
766+
dedent(
767+
"""\
768+
metadata = {"apiLevel": "2.13"}
769+
def run(protocol):
770+
# Prep:
771+
tip_rack = protocol.load_labware("opentrons_96_tiprack_300ul", 1)
772+
well_plate = protocol.load_labware("biorad_96_wellplate_200ul_pcr", 2)
773+
pipette = protocol.load_instrument("p300_single_gen2", mount="left", tip_racks=[tip_rack])
774+
pipette.pick_up_tip()
775+
776+
# Test:
777+
pipette.move_to(well_plate["A1"].top())
778+
pipette.air_gap(100)
779+
"""
780+
)
781+
)
782+
result_commands = await simulate_and_get_commands(path)
783+
[
784+
initial_home,
785+
load_tip_rack,
786+
load_well_plate,
787+
load_pipette,
788+
pick_up_tip,
789+
move_to_well,
790+
air_gap_aspirate,
791+
] = result_commands
792+
assert isinstance(initial_home, commands.Home)
793+
assert isinstance(load_tip_rack, commands.LoadLabware)
794+
assert isinstance(load_well_plate, commands.LoadLabware)
795+
assert isinstance(load_pipette, commands.LoadPipette)
796+
assert isinstance(pick_up_tip, commands.PickUpTip)
797+
# TODO(mm, 2024-04-23): This commands.Custom looks wrong. This should be a commands.MoveToWell.
798+
assert isinstance(move_to_well, commands.Custom)
799+
assert isinstance(air_gap_aspirate, commands.Aspirate)

api/tests/opentrons/protocol_runner/test_legacy_command_mapper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,7 @@ def test_map_pause() -> None:
579579
"command.DISTRIBUTE",
580580
"command.TRANSFER",
581581
"command.RETURN_TIP",
582+
"command.AIR_GAP",
582583
],
583584
)
584585
def test_filter_higher_order_commands(command_type: str) -> None:

0 commit comments

Comments
 (0)