-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(shared-data): validate all models in the v2 pipette folder (#13161)
- Loading branch information
1 parent
fec217d
commit 7da9f74
Showing
2 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import os | ||
from opentrons_shared_data import get_shared_data_root | ||
|
||
from opentrons_shared_data.pipette.pipette_definition import PipetteConfigurations | ||
from opentrons_shared_data.pipette.load_data import load_definition | ||
from opentrons_shared_data.pipette.pipette_load_name_conversions import ( | ||
convert_pipette_model, | ||
) | ||
from opentrons_shared_data.pipette.dev_types import PipetteModel | ||
|
||
|
||
def test_check_all_models_are_valid() -> None: | ||
paths_to_validate = ( | ||
get_shared_data_root() / "pipette" / "definitions" / "2" / "liquid" | ||
) | ||
_channel_model_str = { | ||
"single_channel": "single", | ||
"ninety_six_channel": "96", | ||
"eight_channel": "multi", | ||
} | ||
for channel_dir in os.listdir(paths_to_validate): | ||
for model_dir in os.listdir(paths_to_validate / channel_dir): | ||
for version_file in os.listdir(paths_to_validate / channel_dir / model_dir): | ||
version_list = version_file.split(".json")[0].split("_") | ||
built_model: PipetteModel = PipetteModel( | ||
f"{model_dir}_{_channel_model_str[channel_dir]}_v{version_list[0]}.{version_list[1]}" | ||
) | ||
|
||
model_version = convert_pipette_model(built_model) | ||
loaded_model = load_definition( | ||
model_version.pipette_type, | ||
model_version.pipette_channels, | ||
model_version.pipette_version, | ||
) | ||
|
||
assert isinstance(loaded_model, PipetteConfigurations) |