Skip to content

Commit

Permalink
added water liq class definition with placeholder data
Browse files Browse the repository at this point in the history
  • Loading branch information
sanni-t committed Nov 2, 2024
1 parent e53c910 commit de8d777
Show file tree
Hide file tree
Showing 5 changed files with 5,333 additions and 27 deletions.
27 changes: 12 additions & 15 deletions api/tests/opentrons/protocol_api_integration/test_liquid_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,36 @@ def test_liquid_class_creation_and_property_fetching(
decoy.when(ff.allow_liquid_classes(RobotTypeEnum.OT2)).then_return(True)
protocol_context = simulate.get_protocol_api(version="2.20", robot_type="OT-2")
pipette_left = protocol_context.load_instrument("p20_single_gen2", mount="left")
pipette_right = protocol_context.load_instrument("p300_multi", mount="right")
tiprack = protocol_context.load_labware("opentrons_96_tiprack_20ul", "1")

glycerol_50 = protocol_context.define_liquid_class("fixture_glycerol50")
water = protocol_context.define_liquid_class("water")

assert glycerol_50.name == "fixture_glycerol50"
assert glycerol_50.display_name == "Glycerol 50%"
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
assert (
glycerol_50.get_for(
pipette_left.name, tiprack.load_name
).dispense.flowRateByVolume["default"]
water.get_for(pipette_left.name, tiprack.load_name).dispense.flowRateByVolume[
"default"
]
== 50
)
assert (
glycerol_50.get_for(
pipette_left.name, tiprack.load_name
).aspirate.submerge.speed
water.get_for(pipette_left.name, tiprack.load_name).aspirate.submerge.speed
== 100
)

with pytest.raises(
ValueError,
match="No properties found for p300_multi in fixture_glycerol50 liquid class",
match="No properties found for non-existent-pipette in water liquid class",
):
glycerol_50.get_for(pipette_right.name, tiprack.load_name)
water.get_for("non-existent-pipette", tiprack.load_name)

with pytest.raises(AttributeError):
glycerol_50.name = "foo" # type: ignore
water.name = "foo" # type: ignore

with pytest.raises(AttributeError):
glycerol_50.display_name = "bar" # type: ignore
water.display_name = "bar" # type: ignore

with pytest.raises(ValueError, match="Liquid class definition not found"):
protocol_context.define_liquid_class("non-existent-liquid")
Expand All @@ -57,4 +54,4 @@ def test_liquid_class_feature_flag() -> None:
"""It should raise a not implemented error without the allowLiquidClass flag set."""
protocol_context = simulate.get_protocol_api(version="2.20", robot_type="OT-2")
with pytest.raises(NotImplementedError):
protocol_context.define_liquid_class("fixture_glycerol50")
protocol_context.define_liquid_class("water")
Loading

0 comments on commit de8d777

Please sign in to comment.