Skip to content

Commit f1dde51

Browse files
authored
test(shared-data): check that standard liquid class correction volumes are non-negative (#19075)
# Overview This adds a check to the validation tests for our standard liquid classes to make sure we don't have any values that would push the plunger below the zero position, which would cause a `PipetteNotReadyToAspirateError`. Note that this does not address the problem with user-defined liquid classes. This just helps me be more confident that our standard liquid classes aren't broken out-of-the-box. AUTH-2154 ## Test Plan and Hands on Testing All of our default liquid classes currently pass. ## Risk assessment Low, test-only change.
1 parent 5bc2f93 commit f1dde51

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

shared-data/python_tests/liquid_classes/test_liquid_class_values.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def _get_all_liquid_classes() -> List[str]:
1818
@pytest.mark.parametrize("liquid_class_name", list(_get_all_liquid_classes()))
1919
def test_correction_values_equal_each_other(liquid_class_name: str) -> None:
2020
"""The correction volume values for each pipette/tiprack combo should all be equal to one another."""
21-
liquid_class_def = load_definition(liquid_class_name, version=1, schema_version=1)
21+
liquid_class_def = load_definition(liquid_class_name)
2222
incorrect_combos = []
2323
for by_pipette in liquid_class_def.byPipette:
2424
for liquid_class_props in by_pipette.byTipType:
@@ -39,10 +39,34 @@ def test_correction_values_equal_each_other(liquid_class_name: str) -> None:
3939
assert incorrect_combos == []
4040

4141

42+
@pytest.mark.parametrize("liquid_class_name", list(_get_all_liquid_classes()))
43+
def test_correction_volume_not_negative(liquid_class_name: str) -> None:
44+
"""Correction volumes must not push the plunger below zero position or else PipetteNotReadyToAspirateError."""
45+
liquid_class_def = load_definition(liquid_class_name)
46+
for by_pipette in liquid_class_def.byPipette:
47+
for by_tip_type in by_pipette.byTipType:
48+
# We just need to check one of aspirate/singleDispense/multiDispense, because
49+
# the test above ensures that all 3 are the same.
50+
correction_by_volume = by_tip_type.aspirate.correctionByVolume
51+
# The correction volume at 0 must be 0:
52+
assert (
53+
0.0,
54+
0.0,
55+
) in correction_by_volume, f"Correction volume not 0 at 0 in {by_pipette.pipetteModel} {by_tip_type.tiprack}"
56+
# The nominal volume + correction volume must never be below 0.
57+
# (Seth thinks this check is sufficient to ensure that the plunger won't
58+
# go below the zero position, whereas David thinks we need a stronger
59+
# check that takes into account ul_per_mm(). But this is a start.)
60+
for nominal_volume, correction_volume in correction_by_volume:
61+
assert (
62+
nominal_volume + correction_volume >= 0
63+
), f"Volume + correction volume is negative in {by_pipette.pipetteModel} {by_tip_type.tiprack}"
64+
65+
4266
@pytest.mark.parametrize("liquid_class_name", list(_get_all_liquid_classes()))
4367
def test_flow_rates_equal_each_other(liquid_class_name: str) -> None:
4468
"""The dispense flow rate values for each pipette/tiprack combo should all be equal to one another."""
45-
liquid_class_def = load_definition(liquid_class_name, version=1, schema_version=1)
69+
liquid_class_def = load_definition(liquid_class_name)
4670
incorrect_combos = []
4771
for by_pipette in liquid_class_def.byPipette:
4872
for liquid_class_props in by_pipette.byTipType:

0 commit comments

Comments
 (0)