Skip to content

Commit

Permalink
Fix shared data tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthecoder committed Dec 4, 2024
1 parent 1867faf commit baffc25
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 4 deletions.
8 changes: 7 additions & 1 deletion shared-data/python/tests/pipette/test_load_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
PipetteChannelType,
PipetteModelType,
PipetteVersionType,
PipetteOEMType,
PipetteTipType,
Quirks,
LiquidClasses,
Expand All @@ -20,6 +21,7 @@ def test_load_pipette_definition() -> None:
PipetteModelType.p50,
PipetteChannelType.SINGLE_CHANNEL,
PipetteVersionType(major=3, minor=3),
PipetteOEMType.OT,
)

assert pipette_config_one.channels == 1
Expand All @@ -38,6 +40,7 @@ def test_load_pipette_definition() -> None:
PipetteModelType.p50,
PipetteChannelType.SINGLE_CHANNEL,
PipetteVersionType(major=1, minor=0),
PipetteOEMType.OT,
)

assert pipette_config_two.channels == 1
Expand Down Expand Up @@ -83,7 +86,10 @@ def test_update_pipette_configuration(
cast(types.PipetteModel, pipette_model)
)
base_configurations = load_data.load_definition(
model_name.pipette_type, model_name.pipette_channels, model_name.pipette_version
model_name.pipette_type,
model_name.pipette_channels,
model_name.pipette_version,
model_name.oem_type,
)

updated_configurations = load_data.update_pipette_configuration(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def test_max_flow_rates_per_volume(pipette: PipetteModel, action: str) -> None:
pipette_model_version.pipette_type,
pipette_model_version.pipette_channels,
pipette_model_version.pipette_version,
pipette_model_version.oem_type,
)

pipette_model_version_str = f"{pipette_model_version}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def test_load_old_overrides_regression(
pipette_type=types.PipetteModelType.p20,
pipette_channels=types.PipetteChannelType.SINGLE_CHANNEL,
pipette_version=types.PipetteVersionType(2, 2),
oem_type=types.PipetteOEMType.OT,
),
override_configuration_path,
"P20SV222021040709",
Expand Down Expand Up @@ -269,6 +270,7 @@ def test_load_with_overrides(
pipette_model.pipette_type,
pipette_model.pipette_channels,
pipette_model.pipette_version,
pipette_model.oem_type,
)

if serial_number == TEST_SERIAL_NUMBER:
Expand Down Expand Up @@ -454,7 +456,9 @@ def test_loading_does_not_log_warnings(
load_with_mutable_configurations() suppresses and logs internal exceptions to
protect its caller, but those are still bugs, and we still want tests to catch them.
"""
model = pipette_definition.PipetteModelVersionType(type, channels, version)
model = pipette_definition.PipetteModelVersionType(
type, channels, version, types.PipetteOEMType.OT
)
(override_configuration_path / filename).write_text(file_contents)
with caplog.at_level(logging.WARNING):
mutable_configurations.load_with_mutable_configurations(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
PipetteModelType,
PipetteVersionType,
PipetteGenerationType,
PipetteOEMType,
)
from opentrons_shared_data.pipette.types import PipetteModel, PipetteName
from opentrons_shared_data.pipette import (
Expand All @@ -23,6 +24,7 @@
PipetteModelType.p50,
PipetteChannelType.SINGLE_CHANNEL,
PipetteVersionType(2, 0),
PipetteOEMType.OT,
),
],
[
Expand All @@ -31,6 +33,7 @@
PipetteModelType.p1000,
PipetteChannelType.EIGHT_CHANNEL,
PipetteVersionType(1, 0),
PipetteOEMType.OT,
),
],
[
Expand All @@ -39,6 +42,7 @@
PipetteModelType.p1000,
PipetteChannelType.NINETY_SIX_CHANNEL,
PipetteVersionType(1, 0),
PipetteOEMType.OT,
),
],
],
Expand All @@ -59,6 +63,7 @@ def test_convert_pipette_model(
PipetteModelType.p50,
PipetteChannelType.SINGLE_CHANNEL,
PipetteVersionType(2, 0),
PipetteOEMType.OT,
),
],
[
Expand All @@ -68,6 +73,7 @@ def test_convert_pipette_model(
PipetteModelType.p1000,
PipetteChannelType.EIGHT_CHANNEL,
PipetteVersionType(3, 3),
PipetteOEMType.OT,
),
],
[
Expand All @@ -77,6 +83,7 @@ def test_convert_pipette_model(
PipetteModelType.p1000,
PipetteChannelType.NINETY_SIX_CHANNEL,
PipetteVersionType(1, 1),
PipetteOEMType.OT,
),
],
],
Expand All @@ -96,6 +103,7 @@ def test_convert_pipette_model_provided_version(
PipetteModelType.p50,
PipetteChannelType.SINGLE_CHANNEL,
PipetteVersionType(2, 0),
PipetteOEMType.OT,
),
],
[
Expand All @@ -104,6 +112,7 @@ def test_convert_pipette_model_provided_version(
PipetteModelType.p1000,
PipetteChannelType.EIGHT_CHANNEL,
PipetteVersionType(3, 5),
PipetteOEMType.OT,
),
],
[
Expand All @@ -112,6 +121,7 @@ def test_convert_pipette_model_provided_version(
PipetteModelType.p1000,
PipetteChannelType.NINETY_SIX_CHANNEL,
PipetteVersionType(3, 6),
PipetteOEMType.OT,
),
],
],
Expand All @@ -123,26 +133,29 @@ def test_convert_pipette_name(


@pytest.mark.parametrize(
argnames=["model_type", "channels", "generation", "output"],
argnames=["model_type", "channels", "generation", "output", "oem"],
argvalues=[
[
PipetteModelType.p50,
PipetteChannelType.SINGLE_CHANNEL,
PipetteGenerationType.GEN2,
"p50_single_gen2",
PipetteOEMType.OT,
],
[
PipetteModelType.p1000,
PipetteChannelType.EIGHT_CHANNEL,
PipetteGenerationType.GEN2,
"p1000_multi_gen2",
PipetteOEMType.OT,
],
[
# 96 channel has a unique "name" right now
PipetteModelType.p1000,
PipetteChannelType.NINETY_SIX_CHANNEL,
PipetteGenerationType.FLEX,
"p1000_96",
PipetteOEMType.OT,
],
],
)
Expand All @@ -151,11 +164,13 @@ def test_model_version_type_string_version(
channels: PipetteChannelType,
generation: PipetteGenerationType,
output: PipetteName,
oem: PipetteOEMType,
) -> None:
data = pc.PipetteNameType(
pipette_type=model_type,
pipette_channels=channels,
pipette_generation=generation,
oem_type=oem,
)
assert output == str(data)

Expand All @@ -168,18 +183,21 @@ def test_model_version_type_string_version(
PipetteChannelType.SINGLE_CHANNEL,
PipetteVersionType(1, 0),
"p50_single_v1",
PipetteOEMType.OT,
],
[
PipetteModelType.p1000,
PipetteChannelType.EIGHT_CHANNEL,
PipetteVersionType(2, 1),
"p1000_multi_v2.1",
PipetteOEMType.OT,
],
[
PipetteModelType.p1000,
PipetteChannelType.NINETY_SIX_CHANNEL,
PipetteVersionType(3, 3),
"p1000_96_v3.3",
PipetteOEMType.OT,
],
],
)
Expand All @@ -188,9 +206,13 @@ def test_name_type_string_generation(
channels: PipetteChannelType,
version: PipetteVersionType,
output: PipetteModel,
oem: PipetteOEMType,
) -> None:
data = pc.PipetteModelVersionType(
pipette_type=model_type, pipette_channels=channels, pipette_version=version
pipette_type=model_type,
pipette_channels=channels,
pipette_version=version,
oem_type=oem,
)
assert output == str(data)

Expand Down
5 changes: 5 additions & 0 deletions shared-data/python/tests/pipette/test_validate_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def test_check_all_models_are_valid() -> None:
model_version.pipette_type,
model_version.pipette_channels,
model_version.pipette_version,
model_version.oem_type,
)
except json.JSONDecodeError:
print(
Expand Down Expand Up @@ -81,11 +82,13 @@ def test_pick_up_configs_configuration_by_nozzle_map_keys() -> None:
model_version.pipette_type,
model_version.pipette_channels,
model_version.pipette_version,
model_version.oem_type,
)
valid_nozzle_maps = load_valid_nozzle_maps(
model_version.pipette_type,
model_version.pipette_channels,
model_version.pipette_version,
model_version.oem_type,
)

pipette_maps = list(
Expand Down Expand Up @@ -123,11 +126,13 @@ def test_pick_up_configs_configuration_ordered_from_smallest_to_largest() -> Non
model_version.pipette_type,
model_version.pipette_channels,
model_version.pipette_version,
model_version.oem_type,
)
valid_nozzle_maps = load_valid_nozzle_maps(
model_version.pipette_type,
model_version.pipette_channels,
model_version.pipette_version,
model_version.oem_type,
)

map_keys = list(valid_nozzle_maps.maps.keys())
Expand Down

0 comments on commit baffc25

Please sign in to comment.