From 4994770094a97f1667ee6f743c5d2de0c67a692b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Roos?= Date: Fri, 22 Sep 2023 13:21:22 +0200 Subject: [PATCH] apply pre-commit patch --- src/ansys/dpf/composites/_composite_model_impl.py | 10 ++++++++-- tests/composite_model_test.py | 8 ++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ansys/dpf/composites/_composite_model_impl.py b/src/ansys/dpf/composites/_composite_model_impl.py index 2f264103a..5f659cada 100644 --- a/src/ansys/dpf/composites/_composite_model_impl.py +++ b/src/ansys/dpf/composites/_composite_model_impl.py @@ -151,7 +151,14 @@ def material_names(self) -> Dict[str, int]: Can be used to filter analysis plies or element layers. """ - helper_op = dpf.Operator("composite::materials_container_helper") + try: + helper_op = dpf.Operator("composite::materials_container_helper") + except: + raise RuntimeError( + "Operator composite::materials_container_helper does not exist in the registry " + " of 2024 R1-pre0. Please use the latest preview or the unified installer." + ) + helper_op.inputs.materials_container(self._material_operators.material_provider.outputs) string_field = helper_op.outputs.material_names() material_ids = string_field.scoping.ids @@ -162,7 +169,6 @@ def material_names(self) -> Dict[str, int]: return names - @_deprecated_composite_definition_label def get_mesh(self, composite_definition_label: Optional[str] = None) -> MeshedRegion: """Get the underlying DPF meshed region. diff --git a/tests/composite_model_test.py b/tests/composite_model_test.py index 015ed795b..585980c2d 100644 --- a/tests/composite_model_test.py +++ b/tests/composite_model_test.py @@ -84,10 +84,10 @@ def test_basic_functionality_of_composite_model(dpf_server, data_files, distribu assert [ply["id"] for ply in sampling_point.analysis_plies] == analysis_ply_ids ref_material_names = { - 'Epoxy Carbon UD (230 GPa) Prepreg': 3, - 'Epoxy Carbon Woven (230 GPa) Wet': 2, - 'Honeycomb': 4, - 'Structural Steel': 1 + "Epoxy Carbon UD (230 GPa) Prepreg": 3, + "Epoxy Carbon Woven (230 GPa) Wet": 2, + "Honeycomb": 4, + "Structural Steel": 1, } mat_names = composite_model.material_names assert len(mat_names) == len(ref_material_names)