@opentrons/shared-data 0.0.1-alpha.19 → 0.0.1-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/lib/{bundle.673284981fd97184260c.js → opentrons-shared-data.js} +2 -2
  2. package/lib/opentrons-shared-data.js.map +1 -0
  3. package/package.json +1 -1
  4. package/webpack.config.js +1 -0
  5. package/js/__tests__/__snapshots__/pipettes.test.ts.snap +0 -5969
  6. package/js/__tests__/deckSchemas.test.ts +0 -87
  7. package/js/__tests__/errors.test.js +0 -21
  8. package/js/__tests__/getAreSlotsAdjacent.test.ts +0 -128
  9. package/js/__tests__/getWellNamePerMultiTip.test.ts +0 -162
  10. package/js/__tests__/labwareDefQuirks.test.ts +0 -37
  11. package/js/__tests__/labwareDefSchemaV1.test.ts +0 -82
  12. package/js/__tests__/labwareDefSchemaV2.test.ts +0 -298
  13. package/js/__tests__/moduleAccessors.test.ts +0 -50
  14. package/js/__tests__/moduleSpecsSchema.test.ts +0 -77
  15. package/js/__tests__/pipetteSchemaV2.test.ts +0 -107
  16. package/js/__tests__/pipetteSpecSchemas.test.ts +0 -48
  17. package/js/__tests__/pipettes.test.ts +0 -58
  18. package/js/__tests__/protocolSchemaV4.test.ts +0 -137
  19. package/js/__tests__/protocolSchemaV5.test.ts +0 -137
  20. package/js/__tests__/protocolSchemaV6.test.ts +0 -132
  21. package/js/__tests__/protocolSchemaV7.test.ts +0 -64
  22. package/js/__tests__/protocolValidation.test.ts +0 -83
  23. package/js/__tests__/sortWells.test.ts +0 -40
  24. package/js/__tests__/splitWellsOnColumn.test.ts +0 -21
  25. package/js/__tests__/validateErrors.test.js +0 -34
  26. package/js/constants.ts +0 -338
  27. package/js/cypressUtils.ts +0 -35
  28. package/js/errors.ts +0 -33
  29. package/js/fixtures.ts +0 -161
  30. package/js/getLabware.ts +0 -154
  31. package/js/gripper.ts +0 -29
  32. package/js/helpers/__tests__/getAdapterName.test.ts +0 -31
  33. package/js/helpers/__tests__/getDeckDefFromLoadedLabware.test.ts +0 -12
  34. package/js/helpers/__tests__/getVectorDifference.test.ts +0 -25
  35. package/js/helpers/__tests__/getVectorSum.test.ts +0 -21
  36. package/js/helpers/__tests__/labwareInference.test.ts +0 -84
  37. package/js/helpers/__tests__/orderWells.test.ts +0 -87
  38. package/js/helpers/__tests__/parseProtocolData.test.ts +0 -165
  39. package/js/helpers/__tests__/volume.test.ts +0 -108
  40. package/js/helpers/__tests__/wellSets.test.ts +0 -352
  41. package/js/helpers/get96Channel384WellPlateWells.ts +0 -44
  42. package/js/helpers/getAddressableAreasInProtocol.ts +0 -59
  43. package/js/helpers/getLoadedLabwareDefinitionsByUri.ts +0 -30
  44. package/js/helpers/getModuleVizDims.ts +0 -118
  45. package/js/helpers/getOccludedSlotCountForModule.ts +0 -13
  46. package/js/helpers/getVectorDifference.ts +0 -12
  47. package/js/helpers/getVectorSum.ts +0 -12
  48. package/js/helpers/getWellNamePerMultiTip.ts +0 -86
  49. package/js/helpers/getWellTotalVolume.ts +0 -16
  50. package/js/helpers/index.ts +0 -347
  51. package/js/helpers/labwareInference.ts +0 -92
  52. package/js/helpers/orderWells.ts +0 -69
  53. package/js/helpers/parseProtocolData.ts +0 -141
  54. package/js/helpers/volume.ts +0 -35
  55. package/js/helpers/wellIsRect.ts +0 -6
  56. package/js/helpers/wellSets.ts +0 -155
  57. package/js/index.ts +0 -14
  58. package/js/labwareTools/__tests__/__snapshots__/createIrregularLabware.test.ts.snap +0 -3
  59. package/js/labwareTools/__tests__/__snapshots__/createLabware.test.ts.snap +0 -3
  60. package/js/labwareTools/__tests__/createDefaultDisplayName.test.ts +0 -111
  61. package/js/labwareTools/__tests__/createIrregularLabware.test.ts +0 -226
  62. package/js/labwareTools/__tests__/createLabware.test.ts +0 -147
  63. package/js/labwareTools/index.ts +0 -452
  64. package/js/modules.ts +0 -97
  65. package/js/pipettes.ts +0 -89
  66. package/js/protocols.ts +0 -290
  67. package/js/schema.ts +0 -80
  68. package/js/scripts/generateDeckLayersFromSVG.js +0 -46
  69. package/js/titleCase.ts +0 -30
  70. package/js/types.ts +0 -600
  71. package/lib/bundle.673284981fd97184260c.js.map +0 -1
  72. package/python/.coveragerc +0 -4
  73. package/python/.flake8 +0 -32
  74. package/python/Config.in +0 -10
  75. package/python/Makefile +0 -134
  76. package/python/Pipfile +0 -28
  77. package/python/Pipfile.lock +0 -645
  78. package/python/buildroot.mk +0 -30
  79. package/python/mypy.ini +0 -41
  80. package/python/opentrons_shared_data/__init__.py +0 -17
  81. package/python/opentrons_shared_data/_version.py +0 -20
  82. package/python/opentrons_shared_data/command/__init__.py +0 -52
  83. package/python/opentrons_shared_data/deck/__init__.py +0 -96
  84. package/python/opentrons_shared_data/deck/dev_types.py +0 -180
  85. package/python/opentrons_shared_data/errors/__init__.py +0 -30
  86. package/python/opentrons_shared_data/errors/categories.py +0 -60
  87. package/python/opentrons_shared_data/errors/codes.py +0 -108
  88. package/python/opentrons_shared_data/errors/exceptions.py +0 -915
  89. package/python/opentrons_shared_data/gripper/__init__.py +0 -63
  90. package/python/opentrons_shared_data/gripper/constants.py +0 -6
  91. package/python/opentrons_shared_data/gripper/gripper_definition.py +0 -101
  92. package/python/opentrons_shared_data/labware/__init__.py +0 -22
  93. package/python/opentrons_shared_data/labware/constants.py +0 -7
  94. package/python/opentrons_shared_data/labware/dev_types.py +0 -140
  95. package/python/opentrons_shared_data/labware/labware_definition.py +0 -328
  96. package/python/opentrons_shared_data/load.py +0 -57
  97. package/python/opentrons_shared_data/module/__init__.py +0 -74
  98. package/python/opentrons_shared_data/module/dev_types.py +0 -141
  99. package/python/opentrons_shared_data/pipette/__init__.py +0 -107
  100. package/python/opentrons_shared_data/pipette/dev_types.py +0 -177
  101. package/python/opentrons_shared_data/pipette/file_operation_helpers.py +0 -37
  102. package/python/opentrons_shared_data/pipette/load_data.py +0 -261
  103. package/python/opentrons_shared_data/pipette/model_constants.py +0 -123
  104. package/python/opentrons_shared_data/pipette/mutable_configurations.py +0 -431
  105. package/python/opentrons_shared_data/pipette/pipette_definition.py +0 -503
  106. package/python/opentrons_shared_data/pipette/pipette_load_name_conversions.py +0 -240
  107. package/python/opentrons_shared_data/pipette/scripts/__init__.py +0 -0
  108. package/python/opentrons_shared_data/pipette/scripts/build_json_script.py +0 -469
  109. package/python/opentrons_shared_data/pipette/scripts/update_configuration_files.py +0 -450
  110. package/python/opentrons_shared_data/pipette/types.py +0 -193
  111. package/python/opentrons_shared_data/protocol/__init__.py +0 -13
  112. package/python/opentrons_shared_data/protocol/constants.py +0 -98
  113. package/python/opentrons_shared_data/protocol/dev_types.py +0 -436
  114. package/python/opentrons_shared_data/protocol/models/__init__.py +0 -48
  115. package/python/opentrons_shared_data/protocol/models/protocol_schema_v6.py +0 -145
  116. package/python/opentrons_shared_data/protocol/models/protocol_schema_v7.py +0 -95
  117. package/python/opentrons_shared_data/protocol/models/protocol_schema_v8.py +0 -110
  118. package/python/opentrons_shared_data/protocol/models/shared_models.py +0 -111
  119. package/python/opentrons_shared_data/py.typed +0 -0
  120. package/python/opentrons_shared_data/robot/__init__.py +0 -33
  121. package/python/opentrons_shared_data/robot/dev_types.py +0 -37
  122. package/python/pytest.ini +0 -2
  123. package/python/setup.cfg +0 -5
  124. package/python/setup.py +0 -179
  125. package/python/tests/__init__.py +0 -1
  126. package/python/tests/conftest.py +0 -0
  127. package/python/tests/deck/__init__.py +0 -0
  128. package/python/tests/deck/test_list_names.py +0 -12
  129. package/python/tests/deck/test_position.py +0 -113
  130. package/python/tests/deck/test_typechecks.py +0 -28
  131. package/python/tests/errors/__init__.py +0 -1
  132. package/python/tests/errors/test_error_completeness.py +0 -19
  133. package/python/tests/errors/test_exceptions.py +0 -74
  134. package/python/tests/gripper/__init__.py +0 -0
  135. package/python/tests/gripper/test_definition.py +0 -30
  136. package/python/tests/gripper/test_load.py +0 -16
  137. package/python/tests/labware/__init__.py +0 -13
  138. package/python/tests/labware/test_typechecks.py +0 -21
  139. package/python/tests/module/__init__.py +0 -20
  140. package/python/tests/module/test_load.py +0 -49
  141. package/python/tests/module/test_typechecks.py +0 -34
  142. package/python/tests/pipette/__init__.py +0 -0
  143. package/python/tests/pipette/test_load_data.py +0 -103
  144. package/python/tests/pipette/test_mutable_configurations.py +0 -266
  145. package/python/tests/pipette/test_pipette_definition.py +0 -183
  146. package/python/tests/pipette/test_pipette_load_name_conversions.py +0 -222
  147. package/python/tests/pipette/test_typechecks.py +0 -50
  148. package/python/tests/pipette/test_validate_schema.py +0 -37
  149. package/python/tests/protocol/__init__.py +0 -15
  150. package/python/tests/protocol/test_protocol_schema_v6.py +0 -107
  151. package/python/tests/protocol/test_protocol_schema_v7.py +0 -34
  152. package/python/tests/protocol/test_protocol_schema_v8.py +0 -20
  153. package/python/tests/protocol/test_typechecks.py +0 -36
  154. package/python/tests/robot/__init__.py +0 -0
  155. package/python/tests/robot/test_typechecks.py +0 -20
  156. /package/lib/{bundle.673284981fd97184260c.js.LICENSE.txt → opentrons-shared-data.js.LICENSE.txt} +0 -0
@@ -1,222 +0,0 @@
1
- import pytest
2
-
3
- from typing import Union
4
- from opentrons_shared_data.pipette.types import (
5
- PipetteChannelType,
6
- PipetteModelType,
7
- PipetteVersionType,
8
- PipetteGenerationType,
9
- )
10
- from opentrons_shared_data.pipette.dev_types import PipetteModel, PipetteName
11
- from opentrons_shared_data.pipette import (
12
- pipette_definition as pc,
13
- pipette_load_name_conversions as ps,
14
- )
15
-
16
-
17
- @pytest.mark.parametrize(
18
- argnames=["model", "output"],
19
- argvalues=[
20
- [
21
- "p50_single_v2.0",
22
- pc.PipetteModelVersionType(
23
- PipetteModelType.p50,
24
- PipetteChannelType.SINGLE_CHANNEL,
25
- PipetteVersionType(2, 0),
26
- ),
27
- ],
28
- [
29
- "p1000_multi_v1.0",
30
- pc.PipetteModelVersionType(
31
- PipetteModelType.p1000,
32
- PipetteChannelType.EIGHT_CHANNEL,
33
- PipetteVersionType(1, 0),
34
- ),
35
- ],
36
- [
37
- "p1000_96_v1.0",
38
- pc.PipetteModelVersionType(
39
- PipetteModelType.p1000,
40
- PipetteChannelType.NINETY_SIX_CHANNEL,
41
- PipetteVersionType(1, 0),
42
- ),
43
- ],
44
- ],
45
- )
46
- def test_convert_pipette_model(
47
- model: PipetteModel, output: pc.PipetteModelVersionType
48
- ) -> None:
49
- assert output == ps.convert_pipette_model(model)
50
-
51
-
52
- @pytest.mark.parametrize(
53
- argnames=["model", "version", "output"],
54
- argvalues=[
55
- [
56
- "p50_single",
57
- "2.0",
58
- pc.PipetteModelVersionType(
59
- PipetteModelType.p50,
60
- PipetteChannelType.SINGLE_CHANNEL,
61
- PipetteVersionType(2, 0),
62
- ),
63
- ],
64
- [
65
- "p1000_multi",
66
- "3.3",
67
- pc.PipetteModelVersionType(
68
- PipetteModelType.p1000,
69
- PipetteChannelType.EIGHT_CHANNEL,
70
- PipetteVersionType(3, 3),
71
- ),
72
- ],
73
- [
74
- "p1000_96",
75
- "1.1",
76
- pc.PipetteModelVersionType(
77
- PipetteModelType.p1000,
78
- PipetteChannelType.NINETY_SIX_CHANNEL,
79
- PipetteVersionType(1, 1),
80
- ),
81
- ],
82
- ],
83
- )
84
- def test_convert_pipette_model_provided_version(
85
- model: PipetteModel, version: str, output: pc.PipetteModelVersionType
86
- ) -> None:
87
- assert output == ps.convert_pipette_model(model, version)
88
-
89
-
90
- @pytest.mark.parametrize(
91
- argnames=["name", "output"],
92
- argvalues=[
93
- [
94
- "p50_single_gen2",
95
- pc.PipetteModelVersionType(
96
- PipetteModelType.p50,
97
- PipetteChannelType.SINGLE_CHANNEL,
98
- PipetteVersionType(2, 0),
99
- ),
100
- ],
101
- [
102
- "p1000_multi_flex",
103
- pc.PipetteModelVersionType(
104
- PipetteModelType.p1000,
105
- PipetteChannelType.EIGHT_CHANNEL,
106
- PipetteVersionType(3, 0),
107
- ),
108
- ],
109
- [
110
- "p1000_96",
111
- pc.PipetteModelVersionType(
112
- PipetteModelType.p1000,
113
- PipetteChannelType.NINETY_SIX_CHANNEL,
114
- PipetteVersionType(1, 0),
115
- ),
116
- ],
117
- ],
118
- )
119
- def test_convert_pipette_name(
120
- name: PipetteName, output: pc.PipetteModelVersionType
121
- ) -> None:
122
- assert output == ps.convert_pipette_name(name)
123
-
124
-
125
- @pytest.mark.parametrize(
126
- argnames=["model_type", "channels", "generation", "output"],
127
- argvalues=[
128
- [
129
- PipetteModelType.p50,
130
- PipetteChannelType.SINGLE_CHANNEL,
131
- PipetteGenerationType.GEN2,
132
- "p50_single_gen2",
133
- ],
134
- [
135
- PipetteModelType.p1000,
136
- PipetteChannelType.EIGHT_CHANNEL,
137
- PipetteGenerationType.GEN2,
138
- "p1000_multi_gen2",
139
- ],
140
- [
141
- # 96 channel has a unique "name" right now
142
- PipetteModelType.p1000,
143
- PipetteChannelType.NINETY_SIX_CHANNEL,
144
- PipetteGenerationType.FLEX,
145
- "p1000_96",
146
- ],
147
- ],
148
- )
149
- def test_model_version_type_string_version(
150
- model_type: PipetteModelType,
151
- channels: PipetteChannelType,
152
- generation: PipetteGenerationType,
153
- output: PipetteName,
154
- ) -> None:
155
- data = pc.PipetteNameType(
156
- pipette_type=model_type,
157
- pipette_channels=channels,
158
- pipette_generation=generation,
159
- )
160
- assert output == str(data)
161
-
162
-
163
- @pytest.mark.parametrize(
164
- argnames=["model_type", "channels", "version", "output"],
165
- argvalues=[
166
- [
167
- PipetteModelType.p50,
168
- PipetteChannelType.SINGLE_CHANNEL,
169
- PipetteVersionType(1, 0),
170
- "p50_single_v1",
171
- ],
172
- [
173
- PipetteModelType.p1000,
174
- PipetteChannelType.EIGHT_CHANNEL,
175
- PipetteVersionType(2, 1),
176
- "p1000_multi_v2.1",
177
- ],
178
- [
179
- PipetteModelType.p1000,
180
- PipetteChannelType.NINETY_SIX_CHANNEL,
181
- PipetteVersionType(3, 3),
182
- "p1000_96_v3.3",
183
- ],
184
- ],
185
- )
186
- def test_name_type_string_generation(
187
- model_type: PipetteModelType,
188
- channels: PipetteChannelType,
189
- version: PipetteVersionType,
190
- output: PipetteModel,
191
- ) -> None:
192
- data = pc.PipetteModelVersionType(
193
- pipette_type=model_type, pipette_channels=channels, pipette_version=version
194
- )
195
- assert output == str(data)
196
-
197
-
198
- @pytest.mark.parametrize(
199
- argnames=["model_or_name", "valid"],
200
- argvalues=[
201
- [
202
- "p50_single",
203
- True,
204
- ],
205
- [
206
- "p50_sing",
207
- False,
208
- ],
209
- [
210
- "p100_multi",
211
- False,
212
- ],
213
- [
214
- "p1000_multi_v3.3",
215
- True,
216
- ],
217
- ],
218
- )
219
- def test_supported_pipette(
220
- model_or_name: Union[PipetteName, PipetteModel, None], valid: bool
221
- ) -> None:
222
- assert ps.supported_pipette(model_or_name) == valid
@@ -1,50 +0,0 @@
1
- import sys
2
-
3
- import pytest
4
- import typeguard
5
-
6
- from opentrons_shared_data.pipette import (
7
- model_config,
8
- name_config,
9
- fuse_specs,
10
- dummy_model_for_name,
11
- )
12
- from opentrons_shared_data.pipette.dev_types import (
13
- PipetteModelSpecs,
14
- PipetteNameSpecs,
15
- PipetteFusedSpec,
16
- )
17
-
18
- pytestmark = pytest.mark.xfail(
19
- condition=sys.version_info >= (3, 10),
20
- reason="https://github.com/agronholm/typeguard/issues/242",
21
- )
22
-
23
-
24
- def test_model_config_check():
25
- defdict = model_config()
26
- typeguard.check_type("defdict", defdict, PipetteModelSpecs)
27
-
28
-
29
- def test_name_config_check():
30
- defdict = name_config()
31
- typeguard.check_type("defdict", defdict, PipetteNameSpecs)
32
-
33
-
34
- def build_model_name_pairs():
35
- for model, conf in model_config()["config"].items():
36
- yield model, conf["name"]
37
- for bcn in conf.get("backCompatNames", []):
38
- yield model, bcn
39
-
40
-
41
- @pytest.mark.parametrize("model,name", list(build_model_name_pairs()))
42
- def test_fuse(model, name):
43
- defdict = fuse_specs(model, name)
44
- typeguard.check_type("defdict", defdict, PipetteFusedSpec)
45
-
46
-
47
- @pytest.mark.parametrize("name", list(name_config().keys()))
48
- def test_model_for_name(name):
49
- model = dummy_model_for_name(name)
50
- assert model in model_config()["config"]
@@ -1,37 +0,0 @@
1
- import os
2
- from opentrons_shared_data import get_shared_data_root
3
-
4
- from opentrons_shared_data.pipette.pipette_definition import PipetteConfigurations
5
- from opentrons_shared_data.pipette.load_data import load_definition
6
- from opentrons_shared_data.pipette.pipette_load_name_conversions import (
7
- convert_pipette_model,
8
- )
9
- from opentrons_shared_data.pipette.dev_types import PipetteModel
10
-
11
-
12
- def test_check_all_models_are_valid() -> None:
13
- paths_to_validate = (
14
- get_shared_data_root() / "pipette" / "definitions" / "2" / "general"
15
- )
16
- _channel_model_str = {
17
- "single_channel": "single",
18
- "ninety_six_channel": "96",
19
- "eight_channel": "multi",
20
- }
21
- assert os.listdir(paths_to_validate), "You have a path wrong"
22
- for channel_dir in os.listdir(paths_to_validate):
23
- for model_dir in os.listdir(paths_to_validate / channel_dir):
24
- for version_file in os.listdir(paths_to_validate / channel_dir / model_dir):
25
- version_list = version_file.split(".json")[0].split("_")
26
- built_model: PipetteModel = PipetteModel(
27
- f"{model_dir}_{_channel_model_str[channel_dir]}_v{version_list[0]}.{version_list[1]}"
28
- )
29
-
30
- model_version = convert_pipette_model(built_model)
31
- loaded_model = load_definition(
32
- model_version.pipette_type,
33
- model_version.pipette_channels,
34
- model_version.pipette_version,
35
- )
36
-
37
- assert isinstance(loaded_model, PipetteConfigurations)
@@ -1,15 +0,0 @@
1
- from typing import List
2
- from pathlib import Path
3
-
4
-
5
- def list_fixtures(version: int) -> List[Path]:
6
- base = (
7
- Path(__file__).parent
8
- / ".."
9
- / ".."
10
- / ".."
11
- / "protocol"
12
- / "fixtures"
13
- / f"{version}"
14
- )
15
- return list(base.iterdir())
@@ -1,107 +0,0 @@
1
- import json
2
- import pytest
3
- from typing import Any, Dict
4
- from opentrons_shared_data import load_shared_data
5
- from opentrons_shared_data.protocol.models import (
6
- protocol_schema_v6,
7
- Robot,
8
- Metadata,
9
- Liquid,
10
- Module,
11
- Pipette,
12
- Labware,
13
- )
14
-
15
- from . import list_fixtures
16
-
17
-
18
- @pytest.mark.parametrize("defpath", list_fixtures(6))
19
- def test_v6_types(defpath):
20
- def_data = load_shared_data(defpath)
21
- def_model = protocol_schema_v6.ProtocolSchemaV6.parse_raw(def_data)
22
- def_dict_from_model = def_model.dict(
23
- exclude_unset=True,
24
- # 'schemaVersion' in python is '$schemaVersion' in JSON
25
- by_alias=True,
26
- )
27
- expected_def_dict = json.loads(def_data)
28
- delete_unexpected_results(expected_def_dict)
29
- assert def_dict_from_model == expected_def_dict
30
-
31
-
32
- # TODO (Tamar and Max 3/16/22):
33
- # Some of our v6 fixtures accidentally contain command "result" data,
34
- # which is not part of the schema, and which we don't parse into our models.
35
- # Here, we delete the extra junk from the fixtures.
36
- # Remove this when the fixtures are corrected.
37
- # https://github.com/Opentrons/opentrons/issues/9701
38
- def delete_unexpected_results(protocol_fixture: Dict[str, Any]) -> None:
39
- for command_object_dict in protocol_fixture["commands"]:
40
- command_object_dict.pop("result", None)
41
- command_object_dict.pop("id", None)
42
-
43
-
44
- @pytest.mark.parametrize(
45
- "input_command, missing_id, load_command",
46
- [
47
- (
48
- protocol_schema_v6.Command(
49
- commandType="loadLabware",
50
- params=protocol_schema_v6.Params(labwareId="labware-id-3"),
51
- ),
52
- "labware-id-3",
53
- "loadLabware",
54
- ),
55
- (
56
- protocol_schema_v6.Command(
57
- commandType="loadPipette",
58
- params=protocol_schema_v6.Params(pipetteId="pipette-id-3"),
59
- ),
60
- "pipette-id-3",
61
- "loadPipette",
62
- ),
63
- (
64
- protocol_schema_v6.Command(
65
- commandType="loadLiquid",
66
- params=protocol_schema_v6.Params(liquidId="liquid-id-3"),
67
- ),
68
- "liquid-id-3",
69
- "loadLiquid",
70
- ),
71
- (
72
- protocol_schema_v6.Command(
73
- commandType="loadModule",
74
- params=protocol_schema_v6.Params(moduleId="module-id-3"),
75
- ),
76
- "module-id-3",
77
- "loadModule",
78
- ),
79
- ],
80
- )
81
- def test_schema_validators(
82
- input_command: protocol_schema_v6.Command, missing_id: str, load_command: str
83
- ) -> None:
84
- """Should raise an error the keys do not match."""
85
- labware = {
86
- "labware-id-1": Labware(definitionId="definition-1"),
87
- "labware-id-2": Labware(definitionId="definition-2"),
88
- }
89
- pipettes = {"pipette-id-1": Pipette(name="pipette-1")}
90
- liquids = {"liquid-id-1": Liquid(displayName="liquid-1", description="liquid desc")}
91
- modules = {"module-id-1": Module(model="model-1")}
92
- with pytest.raises(
93
- ValueError,
94
- match=f"{load_command} command at index 0 references ID {missing_id}, which doesn't exist.",
95
- ):
96
- protocol_schema_v6.ProtocolSchemaV6(
97
- otSharedSchema="#/protocol/schemas/6",
98
- schemaVersion=6,
99
- metadata=Metadata(),
100
- robot=Robot(model="OT-2 Standard", deckId=""),
101
- labware=labware,
102
- pipettes=pipettes,
103
- liquids=liquids,
104
- modules=modules,
105
- labwareDefinitions={},
106
- commands=[input_command],
107
- )
@@ -1,34 +0,0 @@
1
- import json
2
- import pytest
3
- from typing import Any, Dict
4
-
5
- from opentrons_shared_data import load_shared_data
6
- from opentrons_shared_data.protocol.models import protocol_schema_v7
7
-
8
- from . import list_fixtures
9
-
10
-
11
- @pytest.mark.parametrize("defpath", list_fixtures(7))
12
- def test_v7_types(defpath):
13
- def_data = load_shared_data(defpath)
14
- def_model = protocol_schema_v7.ProtocolSchemaV7.parse_raw(def_data)
15
- def_dict_from_model = def_model.dict(
16
- exclude_unset=True,
17
- # 'schemaVersion' in python is '$schemaVersion' in JSON
18
- by_alias=True,
19
- )
20
- expected_def_dict = json.loads(def_data)
21
- delete_unexpected_results(expected_def_dict)
22
- assert def_dict_from_model == expected_def_dict
23
-
24
-
25
- # TODO (Tamar and Max 3/16/22):
26
- # Some of our v7 fixtures accidentally contain command "result" data,
27
- # which is not part of the schema, and which we don't parse into our models.
28
- # Here, we delete the extra junk from the fixtures.
29
- # Remove this when the fixtures are corrected.
30
- # https://github.com/Opentrons/opentrons/issues/9701
31
- def delete_unexpected_results(protocol_fixture: Dict[str, Any]) -> None:
32
- for command_object_dict in protocol_fixture["commands"]:
33
- command_object_dict.pop("result", None)
34
- command_object_dict.pop("id", None)
@@ -1,20 +0,0 @@
1
- import json
2
- import pytest
3
-
4
- from opentrons_shared_data import load_shared_data
5
- from opentrons_shared_data.protocol.models import protocol_schema_v8
6
-
7
- from . import list_fixtures
8
-
9
-
10
- @pytest.mark.parametrize("defpath", list_fixtures(8))
11
- def test_v8_types(defpath):
12
- def_data = load_shared_data(defpath)
13
- def_model = protocol_schema_v8.ProtocolSchemaV8.parse_raw(def_data)
14
- def_dict_from_model = def_model.dict(
15
- exclude_unset=True,
16
- # 'schemaVersion' in python is '$schemaVersion' in JSON
17
- by_alias=True,
18
- )
19
- expected_def_dict = json.loads(def_data)
20
- assert def_dict_from_model == expected_def_dict
@@ -1,36 +0,0 @@
1
- import json
2
- import sys
3
- import pytest
4
- import typeguard
5
-
6
- from opentrons_shared_data import load_shared_data
7
- from opentrons_shared_data.protocol.dev_types import (
8
- JsonProtocolV3,
9
- JsonProtocolV4,
10
- JsonProtocolV5,
11
- )
12
- from . import list_fixtures
13
-
14
-
15
- pytestmark = pytest.mark.xfail(
16
- condition=sys.version_info >= (3, 10),
17
- reason="https://github.com/agronholm/typeguard/issues/242",
18
- )
19
-
20
-
21
- @pytest.mark.parametrize("defpath", list_fixtures(3))
22
- def test_v3_types(defpath):
23
- defn = json.loads(load_shared_data(defpath))
24
- typeguard.check_type("defn", defn, JsonProtocolV3)
25
-
26
-
27
- @pytest.mark.parametrize("defpath", list_fixtures(4))
28
- def test_v4_types(defpath):
29
- defn = json.loads(load_shared_data(defpath))
30
- typeguard.check_type("defn", defn, JsonProtocolV4)
31
-
32
-
33
- @pytest.mark.parametrize("defpath", list_fixtures(5))
34
- def test_v5_types(defpath):
35
- defn = json.loads(load_shared_data(defpath))
36
- typeguard.check_type("defn", defn, JsonProtocolV5)
File without changes
@@ -1,20 +0,0 @@
1
- import sys
2
-
3
- import pytest
4
- import typeguard
5
-
6
-
7
- from opentrons_shared_data.robot import load
8
- from opentrons_shared_data.robot.dev_types import RobotDefinition, RobotType
9
-
10
- pytestmark = pytest.mark.xfail(
11
- condition=sys.version_info >= (3, 10),
12
- reason="https://github.com/agronholm/typeguard/issues/242",
13
- )
14
-
15
-
16
- @pytest.mark.parametrize("defname", ["OT-2 Standard", "OT-3 Standard"])
17
- def test_v1_defs(defname: RobotType) -> None:
18
- defn = load(robot_type=defname, version=1)
19
- typeguard.check_type("defn", defn, RobotDefinition)
20
- assert defn["robotType"] == defname