Skip to content

Commit

Permalink
fix(shared-data): Migrate units for mutable configs (#13471)
Browse files Browse the repository at this point in the history
  • Loading branch information
Laura-Danielle authored Sep 6, 2023
1 parent 2234b74 commit 96834e6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions shared-data/python/opentrons_shared_data/pipette/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ def build(
max: float,
name: str,
) -> "MutableConfig":
if units == "mm/sec":
units = "mm/s"
return cls(
value=value,
default=default,
Expand Down
15 changes: 15 additions & 0 deletions shared-data/python/tests/pipette/test_mutable_configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,18 @@ def test_load_with_overrides(
assert updated_configurations_dict == dict_loaded_configs
else:
assert updated_configurations == loaded_base_configurations


def test_build_mutable_config_using_old_units() -> None:
"""Test that MutableConfigs can build with old units."""
old_units_config = {
"value": 5,
"default": 5.0,
"units": "mm/s",
"type": "float",
"min": 0.01,
"max": 30,
}
assert (
types.MutableConfig.build(**old_units_config, name="dropTipSpeed") is not None
)

0 comments on commit 96834e6

Please sign in to comment.