Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
(#1360) add new param test
Browse files Browse the repository at this point in the history
  • Loading branch information
d-perl committed May 9, 2024
1 parent 710262e commit 79c6e34
Showing 1 changed file with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
from hyperion.parameters.plan_specific.rotation_scan_internal_params import (
RotationInternalParameters,
)
from hyperion.parameters.rotation import RotationScan

from ....conftest import raw_params_from_file

Expand Down Expand Up @@ -373,7 +374,6 @@ def after_main_do(callbacks: list[RotationISPyBCallback]):
def test_ispyb_specifies_experiment_type_if_supplied(
rotation_ispyb: MagicMock,
RE: RunEngine,
params: RotationInternalParameters,
):
raw_params = raw_params_from_file(
"tests/test_data/parameter_json_files/good_test_rotation_scan_parameters.json"
Expand All @@ -399,6 +399,37 @@ def test_ispyb_specifies_experiment_type_if_supplied(
assert rotation_ispyb.call_args.args[1] == IspybExperimentType.CHARACTERIZATION


@patch(
"hyperion.external_interaction.callbacks.rotation.ispyb_callback.StoreInIspyb",
autospec=True,
)
def test_new_params_ispyb_specifies_experiment_type_if_supplied(
rotation_ispyb: MagicMock,
RE: RunEngine,
):
raw_params = raw_params_from_file(
"tests/test_data/new_parameter_json_files/good_test_rotation_scan_parameters_nomove.json"
)
raw_params["ispyb_experiment_type"] = "Characterization"
new_params = RotationScan(**raw_params)
params = new_params.old_parameters()

ispyb_cb = RotationISPyBCallback()
ispyb_cb.active = True
assert (
params.hyperion_params.ispyb_params.ispyb_experiment_type == "Characterization"
)
rotation_ispyb.return_value.begin_deposition.return_value = IspybIds(
data_collection_group_id=23, data_collection_ids=(45,)
)

params.hyperion_params.ispyb_params.sample_id = "abc"

RE(fake_rotation_scan(params, [ispyb_cb]))

assert rotation_ispyb.call_args.args[1] == IspybExperimentType.CHARACTERIZATION


n_images_store_id = [
(123, False),
(3600, True),
Expand Down

0 comments on commit 79c6e34

Please sign in to comment.