Skip to content

Commit 69ee437

Browse files
committed
fix the same in check_valid_volume_parameters too
1 parent 4437827 commit 69ee437

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

api/src/opentrons/protocol_api/core/engine/instrument.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1180,10 +1180,11 @@ def aspirate_liquid_class(
11801180
Return: List of liquid and air gap pairs in tip.
11811181
"""
11821182
aspirate_props = transfer_properties.aspirate
1183+
# TODO (spp, 2025-01-30): check if check_valid_volume_parameters is necessary and is enough.
11831184
tx_commons.check_valid_volume_parameters(
11841185
disposal_volume=0, # No disposal volume for 1-to-1 transfer
11851186
air_gap=aspirate_props.retract.air_gap_by_volume.get_for_volume(volume),
1186-
max_volume=self.get_max_volume(),
1187+
max_volume=self.get_working_volume(),
11871188
)
11881189
source_loc, source_well = source
11891190
aspirate_point = (

api/tests/opentrons/protocol_api/core/engine/test_instrument_core.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,6 +1786,42 @@ def test_aspirate_liquid_class(
17861786
assert result == [LiquidAndAirGapPair(air_gap=222, liquid=111)]
17871787

17881788

1789+
def test_aspirate_liquid_class_raises_for_more_than_max_volume(
1790+
decoy: Decoy,
1791+
mock_engine_client: EngineClient,
1792+
subject: InstrumentCore,
1793+
minimal_liquid_class_def2: LiquidClassSchemaV1,
1794+
mock_transfer_components_executor: TransferComponentsExecutor,
1795+
) -> None:
1796+
"""It should call aspirate sub-steps execution based on liquid class."""
1797+
source_well = decoy.mock(cls=WellCore)
1798+
source_location = Location(Point(1, 2, 3), labware=None)
1799+
test_liquid_class = LiquidClass.create(minimal_liquid_class_def2)
1800+
test_transfer_properties = test_liquid_class.get_for(
1801+
"flex_1channel_50", "opentrons_flex_96_tiprack_50ul"
1802+
)
1803+
decoy.when(
1804+
mock_engine_client.state.pipettes.get_working_volume("abc123")
1805+
).then_return(100)
1806+
decoy.when(
1807+
tx_commons.check_valid_volume_parameters(
1808+
disposal_volume=0,
1809+
air_gap=test_transfer_properties.aspirate.retract.air_gap_by_volume.get_for_volume(
1810+
123
1811+
),
1812+
max_volume=100,
1813+
)
1814+
).then_raise(ValueError("Oh oh!"))
1815+
with pytest.raises(ValueError, match="Oh oh!"):
1816+
subject.aspirate_liquid_class(
1817+
volume=123,
1818+
source=(source_location, source_well),
1819+
transfer_properties=test_transfer_properties,
1820+
transfer_type=TransferType.ONE_TO_ONE,
1821+
tip_contents=[],
1822+
)
1823+
1824+
17891825
def test_dispense_liquid_class(
17901826
decoy: Decoy,
17911827
mock_engine_client: EngineClient,

0 commit comments

Comments
 (0)