Skip to content

Commit

Permalink
allow only default value for properties by volume
Browse files Browse the repository at this point in the history
  • Loading branch information
sanni-t committed Nov 18, 2024
1 parent d8c01cd commit d27fcee
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
6 changes: 4 additions & 2 deletions api/src/opentrons/protocol_api/_liquid_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ def delete_for_volume(self, volume: float) -> None:

def _sort_volume_and_values(self) -> None:
"""Sort volume in increasing order along with corresponding values in matching order."""
self._sorted_volumes, self._sorted_values = zip(
*sorted(self._properties_by_volume.items())
self._sorted_volumes, self._sorted_values = (
zip(*sorted(self._properties_by_volume.items()))
if len(self._properties_by_volume) > 0
else [(), ()]
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ def test_build_aspirate_settings() -> None:

assert aspirate_properties.position_reference.value == "well-bottom"
assert aspirate_properties.offset == Coordinate(x=0, y=0, z=-5)
assert aspirate_properties.flow_rate_by_volume.as_dict() == {
"default": 50.0,
10.0: 40.0,
20.0: 30.0,
}
assert aspirate_properties.flow_rate_by_volume.as_dict() == {"default": 50.0}
assert aspirate_properties.pre_wet is True
assert aspirate_properties.mix.enabled is True
assert aspirate_properties.mix.repetitions == 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,36 @@
from opentrons.config import feature_flags as ff


@pytest.mark.ot2_only
@pytest.mark.ot3_only
@pytest.mark.parametrize(
"simulated_protocol_context", [("2.20", "OT-2")], indirect=True
"simulated_protocol_context", [("2.20", "Flex")], indirect=True
)
def test_liquid_class_creation_and_property_fetching(
decoy: Decoy,
mock_feature_flags: None,
simulated_protocol_context: ProtocolContext,
) -> None:
"""It should create the liquid class and provide access to its properties."""
decoy.when(ff.allow_liquid_classes(RobotTypeEnum.OT2)).then_return(True)
pipette_left = simulated_protocol_context.load_instrument(
"p20_single_gen2", mount="left"
decoy.when(ff.allow_liquid_classes(RobotTypeEnum.FLEX)).then_return(True)
pipette_load_name = "flex_8channel_50"
simulated_protocol_context.load_instrument(pipette_load_name, mount="left")
tiprack = simulated_protocol_context.load_labware(
"opentrons_flex_96_tiprack_50ul", "D1"
)
tiprack = simulated_protocol_context.load_labware("opentrons_96_tiprack_20ul", "1")
water = simulated_protocol_context.define_liquid_class("water")

assert water.name == "water"
assert water.display_name == "Water"

# TODO (spp, 2024-10-17): update this to use pipette's load name instead of pipette.name
# TODO (spp, 2024-10-17): update this to fetch pipette load name from instrument context
assert (
water.get_for(
pipette_left.name, tiprack.load_name
pipette_load_name, tiprack.load_name
).dispense.flow_rate_by_volume.default
== 50
)
assert (
water.get_for(pipette_left.name, tiprack.load_name).aspirate.submerge.speed
water.get_for(pipette_load_name, tiprack.load_name).aspirate.submerge.speed
== 100
)

Expand Down
4 changes: 1 addition & 3 deletions shared-data/liquid-class/fixtures/fixture_glycerol50.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@
"z": -5
},
"flowRateByVolume": {
"default": 50,
"10": 40,
"20": 30
"default": 50
},
"preWet": true,
"mix": {
Expand Down

0 comments on commit d27fcee

Please sign in to comment.