-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(snapshot): default doesnt match choice
- Loading branch information
Showing
7 changed files
with
304 additions
and
4 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
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
61 changes: 61 additions & 0 deletions
61
...ting/files/protocols/Flex/Error/v2_18_NO_PIPETTES_Overrides_DefaultChoiceNoMatchChoice.py
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,61 @@ | ||
# I am going to get added to in the test runner | ||
# type_to_test = wrong_type_in_display_name | ||
# protocol.override_variable_name = type_to_test | ||
|
||
metadata = { | ||
"protocolName": "default choice does not match a choice", | ||
} | ||
|
||
requirements = {"robotType": "Flex", "apiLevel": "2.18"} | ||
|
||
|
||
# change me to test that a bad type is caught | ||
# for each field of parameter. | ||
# protocol.overrides is a list of these strings | ||
str_default_no_matching_choices = "str_default_no_matching_choices" | ||
float_default_no_matching_choices = "float_default_no_matching_choices" | ||
int_default_no_matching_choices = "int_default_no_matching_choices" | ||
|
||
|
||
def add_parameters(parameters): | ||
match type_to_test: | ||
case str() if type_to_test == int_default_no_matching_choices: | ||
parameters.add_int( | ||
display_name="Mixing Volume in µL", | ||
variable_name="mix_in_volume", | ||
default=10, | ||
choices=[ | ||
{"display_name": "Low Volume ⬇️", "value": 9}, | ||
{"display_name": "Medium Volume 🟰", "value": 15}, | ||
{"display_name": "High Volume ⬆️", "value": 20}, | ||
], | ||
description="This is a description.", | ||
) | ||
case str() if type_to_test == float_default_no_matching_choices: | ||
parameters.add_float( | ||
display_name="Mixing Volume in µL", | ||
variable_name="mix_in_volume", | ||
default=150.0, | ||
choices=[ | ||
{"display_name": "Low Volume ⬇️", "value": 100.0}, | ||
{"display_name": "Medium Volume 🟰", "value": 160.0}, | ||
{"display_name": "High Volume ⬆️", "value": 200.0}, | ||
], | ||
description="This is a description.", | ||
) | ||
case str() if type_to_test == str_default_no_matching_choices: | ||
parameters.add_str( | ||
display_name="Pipette Name", | ||
variable_name="pipette", | ||
choices=[ | ||
{"display_name": "1channel", "value": "flex_1channel_50"}, | ||
{"display_name": "Eight Channel 50µL", "value": "flex_8channel_50"}, | ||
], | ||
default="I am not in the choices", | ||
description="This is a description.", | ||
) | ||
|
||
|
||
def run(context): | ||
for variable_name, value in context.params.get_all().items(): | ||
context.comment(f"variable {variable_name} has value {value}") |
74 changes: 74 additions & 0 deletions
74
...TES_Overrides_DefaultChoiceNoMatchChoice_Override_float_default_no_matching_choices].json
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,74 @@ | ||
{ | ||
"commands": [ | ||
{ | ||
"commandType": "home", | ||
"notes": [], | ||
"params": {}, | ||
"result": {}, | ||
"status": "succeeded" | ||
} | ||
], | ||
"config": { | ||
"apiVersion": [ | ||
2, | ||
18 | ||
], | ||
"protocolType": "python" | ||
}, | ||
"errors": [ | ||
{ | ||
"detail": "ParameterValueError [line 36]: Parameter must be set to one of the allowed values of {160.0, 100.0, 200.0}.", | ||
"errorCode": "4000", | ||
"errorInfo": {}, | ||
"errorType": "ExceptionInProtocolError", | ||
"wrappedErrors": [ | ||
{ | ||
"detail": "opentrons.protocols.parameters.types.ParameterValueError: Parameter must be set to one of the allowed values of {160.0, 100.0, 200.0}.", | ||
"errorCode": "4000", | ||
"errorInfo": { | ||
"args": "('Parameter must be set to one of the allowed values of {160.0, 100.0, 200.0}.',)", | ||
"class": "ParameterValueError", | ||
"traceback": " File \"/usr/local/lib/python3.10/site-packages/opentrons/protocols/execution/execute_python.py\", line 80, in _parse_and_set_parameters\n exec(\"add_parameters(__param_context)\", new_globs)\n\n File \"<string>\", line 1, in <module>\n\n File \"v2_18_NO_PIPETTES_Overrides_DefaultChoiceNoMatchChoice_Override_float_default_no_matching_choices.py\", line 36, in add_parameters\n\n File \"/usr/local/lib/python3.10/site-packages/opentrons/protocol_api/_parameter_context.py\", line 91, in add_float\n parameter = parameter_definition.create_float_parameter(\n\n File \"/usr/local/lib/python3.10/site-packages/opentrons/protocols/parameters/parameter_definition.py\", line 202, in create_float_parameter\n return ParameterDefinition(\n\n File \"/usr/local/lib/python3.10/site-packages/opentrons/protocols/parameters/parameter_definition.py\", line 84, in __init__\n self.value: ParamType = default\n\n File \"/usr/local/lib/python3.10/site-packages/opentrons/protocols/parameters/parameter_definition.py\", line 95, in value\n raise ParameterValueError(\n" | ||
}, | ||
"errorType": "PythonException", | ||
"wrappedErrors": [] | ||
} | ||
] | ||
} | ||
], | ||
"files": [ | ||
{ | ||
"name": "cpx_4_tuberack_100ul.json", | ||
"role": "labware" | ||
}, | ||
{ | ||
"name": "opentrons_ot3_96_tiprack_1000ul_rss.json", | ||
"role": "labware" | ||
}, | ||
{ | ||
"name": "opentrons_ot3_96_tiprack_200ul_rss.json", | ||
"role": "labware" | ||
}, | ||
{ | ||
"name": "opentrons_ot3_96_tiprack_50ul_rss.json", | ||
"role": "labware" | ||
}, | ||
{ | ||
"name": "sample_labware.json", | ||
"role": "labware" | ||
}, | ||
{ | ||
"name": "v2_18_NO_PIPETTES_Overrides_DefaultChoiceNoMatchChoice_Override_float_default_no_matching_choices.py", | ||
"role": "main" | ||
} | ||
], | ||
"labware": [], | ||
"liquids": [], | ||
"metadata": { | ||
"protocolName": "default choice does not match a choice" | ||
}, | ||
"modules": [], | ||
"pipettes": [], | ||
"robotType": "OT-3 Standard", | ||
"runTimeParameters": [] | ||
} |
74 changes: 74 additions & 0 deletions
74
...ETTES_Overrides_DefaultChoiceNoMatchChoice_Override_str_default_no_matching_choices].json
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,74 @@ | ||
{ | ||
"commands": [ | ||
{ | ||
"commandType": "home", | ||
"notes": [], | ||
"params": {}, | ||
"result": {}, | ||
"status": "succeeded" | ||
} | ||
], | ||
"config": { | ||
"apiVersion": [ | ||
2, | ||
18 | ||
], | ||
"protocolType": "python" | ||
}, | ||
"errors": [ | ||
{ | ||
"detail": "ParameterValueError [line 48]: Parameter must be set to one of the allowed values of {'flex_8channel_50', 'flex_1channel_50'}.", | ||
"errorCode": "4000", | ||
"errorInfo": {}, | ||
"errorType": "ExceptionInProtocolError", | ||
"wrappedErrors": [ | ||
{ | ||
"detail": "opentrons.protocols.parameters.types.ParameterValueError: Parameter must be set to one of the allowed values of {'flex_8channel_50', 'flex_1channel_50'}.", | ||
"errorCode": "4000", | ||
"errorInfo": { | ||
"args": "(\"Parameter must be set to one of the allowed values of {'flex_8channel_50', 'flex_1channel_50'}.\",)", | ||
"class": "ParameterValueError", | ||
"traceback": " File \"/usr/local/lib/python3.10/site-packages/opentrons/protocols/execution/execute_python.py\", line 80, in _parse_and_set_parameters\n exec(\"add_parameters(__param_context)\", new_globs)\n\n File \"<string>\", line 1, in <module>\n\n File \"v2_18_NO_PIPETTES_Overrides_DefaultChoiceNoMatchChoice_Override_str_default_no_matching_choices.py\", line 48, in add_parameters\n\n File \"/usr/local/lib/python3.10/site-packages/opentrons/protocol_api/_parameter_context.py\", line 148, in add_str\n parameter = parameter_definition.create_str_parameter(\n\n File \"/usr/local/lib/python3.10/site-packages/opentrons/protocols/parameters/parameter_definition.py\", line 241, in create_str_parameter\n return ParameterDefinition(\n\n File \"/usr/local/lib/python3.10/site-packages/opentrons/protocols/parameters/parameter_definition.py\", line 84, in __init__\n self.value: ParamType = default\n\n File \"/usr/local/lib/python3.10/site-packages/opentrons/protocols/parameters/parameter_definition.py\", line 95, in value\n raise ParameterValueError(\n" | ||
}, | ||
"errorType": "PythonException", | ||
"wrappedErrors": [] | ||
} | ||
] | ||
} | ||
], | ||
"files": [ | ||
{ | ||
"name": "cpx_4_tuberack_100ul.json", | ||
"role": "labware" | ||
}, | ||
{ | ||
"name": "opentrons_ot3_96_tiprack_1000ul_rss.json", | ||
"role": "labware" | ||
}, | ||
{ | ||
"name": "opentrons_ot3_96_tiprack_200ul_rss.json", | ||
"role": "labware" | ||
}, | ||
{ | ||
"name": "opentrons_ot3_96_tiprack_50ul_rss.json", | ||
"role": "labware" | ||
}, | ||
{ | ||
"name": "sample_labware.json", | ||
"role": "labware" | ||
}, | ||
{ | ||
"name": "v2_18_NO_PIPETTES_Overrides_DefaultChoiceNoMatchChoice_Override_str_default_no_matching_choices.py", | ||
"role": "main" | ||
} | ||
], | ||
"labware": [], | ||
"liquids": [], | ||
"metadata": { | ||
"protocolName": "default choice does not match a choice" | ||
}, | ||
"modules": [], | ||
"pipettes": [], | ||
"robotType": "OT-3 Standard", | ||
"runTimeParameters": [] | ||
} |
74 changes: 74 additions & 0 deletions
74
...ETTES_Overrides_DefaultChoiceNoMatchChoice_Override_int_default_no_matching_choices].json
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,74 @@ | ||
{ | ||
"commands": [ | ||
{ | ||
"commandType": "home", | ||
"notes": [], | ||
"params": {}, | ||
"result": {}, | ||
"status": "succeeded" | ||
} | ||
], | ||
"config": { | ||
"apiVersion": [ | ||
2, | ||
18 | ||
], | ||
"protocolType": "python" | ||
}, | ||
"errors": [ | ||
{ | ||
"detail": "ParameterValueError [line 24]: Parameter must be set to one of the allowed values of {9, 20, 15}.", | ||
"errorCode": "4000", | ||
"errorInfo": {}, | ||
"errorType": "ExceptionInProtocolError", | ||
"wrappedErrors": [ | ||
{ | ||
"detail": "opentrons.protocols.parameters.types.ParameterValueError: Parameter must be set to one of the allowed values of {9, 20, 15}.", | ||
"errorCode": "4000", | ||
"errorInfo": { | ||
"args": "('Parameter must be set to one of the allowed values of {9, 20, 15}.',)", | ||
"class": "ParameterValueError", | ||
"traceback": " File \"/usr/local/lib/python3.10/site-packages/opentrons/protocols/execution/execute_python.py\", line 80, in _parse_and_set_parameters\n exec(\"add_parameters(__param_context)\", new_globs)\n\n File \"<string>\", line 1, in <module>\n\n File \"v2_18_NO_PIPETTES_Overrides_DefaultChoiceNoMatchChoice_Override_int_default_no_matching_choices.py\", line 24, in add_parameters\n\n File \"/usr/local/lib/python3.10/site-packages/opentrons/protocol_api/_parameter_context.py\", line 55, in add_int\n parameter = parameter_definition.create_int_parameter(\n\n File \"/usr/local/lib/python3.10/site-packages/opentrons/protocols/parameters/parameter_definition.py\", line 178, in create_int_parameter\n return ParameterDefinition(\n\n File \"/usr/local/lib/python3.10/site-packages/opentrons/protocols/parameters/parameter_definition.py\", line 84, in __init__\n self.value: ParamType = default\n\n File \"/usr/local/lib/python3.10/site-packages/opentrons/protocols/parameters/parameter_definition.py\", line 95, in value\n raise ParameterValueError(\n" | ||
}, | ||
"errorType": "PythonException", | ||
"wrappedErrors": [] | ||
} | ||
] | ||
} | ||
], | ||
"files": [ | ||
{ | ||
"name": "cpx_4_tuberack_100ul.json", | ||
"role": "labware" | ||
}, | ||
{ | ||
"name": "opentrons_ot3_96_tiprack_1000ul_rss.json", | ||
"role": "labware" | ||
}, | ||
{ | ||
"name": "opentrons_ot3_96_tiprack_200ul_rss.json", | ||
"role": "labware" | ||
}, | ||
{ | ||
"name": "opentrons_ot3_96_tiprack_50ul_rss.json", | ||
"role": "labware" | ||
}, | ||
{ | ||
"name": "sample_labware.json", | ||
"role": "labware" | ||
}, | ||
{ | ||
"name": "v2_18_NO_PIPETTES_Overrides_DefaultChoiceNoMatchChoice_Override_int_default_no_matching_choices.py", | ||
"role": "main" | ||
} | ||
], | ||
"labware": [], | ||
"liquids": [], | ||
"metadata": { | ||
"protocolName": "default choice does not match a choice" | ||
}, | ||
"modules": [], | ||
"pipettes": [], | ||
"robotType": "OT-3 Standard", | ||
"runTimeParameters": [] | ||
} |