def test_transform_dependents_depends_on_are_updated_when_transformation_name_is_changed( ): nexus_wrapper = NexusWrapper(str(uuid1())) test_name = "slartibartfast" test_value = 42 test_vector = QVector3D(1.0, 0.0, 0.0) test_type = "Translation" transform_dataset = _add_transform_to_file(nexus_wrapper, test_name, test_value, test_vector, test_type) component = nexus_wrapper.create_nx_group("test", "NXaperture", nexus_wrapper.nexus_file) component.create_dataset("depends_on", data=transform_dataset.name) transform = Transformation(nexus_wrapper, transform_dataset) transform.register_dependent(Component(nexus_wrapper, component)) new_name = test_name + "1" transform.name = new_name assert transform.name == new_name assert str(component["depends_on"][()], encoding="UTF-8") == transform.dataset.name
def test_validate_group_reports_problem_when_group_does_not_have_expected_nx_class( ): nexus_wrapper = NexusWrapper() group = nexus_wrapper.create_nx_group("test_group", "NXsomething", nexus_wrapper.nexus_file) problems = validate_group(group, "NXtest", ()) assert ( len(problems) > 0 ), "Expected there to be a reported problem because group does not have expected NX_class"
def test_validate_group_does_not_report_problem_when_group_has_expected_nx_class( ): nexus_wrapper = NexusWrapper() nexus_class = "NXtest" group = nexus_wrapper.create_nx_group("test_group", nexus_class, nexus_wrapper.nexus_file) problems = validate_group(group, nexus_class, ()) assert ( len(problems) == 0 ), "Expected there to be no reported problem because group has expected NX_class"