diff --git a/doc/changelog.d/624.miscellaneous.md b/doc/changelog.d/624.miscellaneous.md new file mode 100644 index 000000000..07d7fb811 --- /dev/null +++ b/doc/changelog.d/624.miscellaneous.md @@ -0,0 +1 @@ +Updated test assertion and test point enums to fix failing unit tests diff --git a/src/ansys/sherlock/core/layer.py b/src/ansys/sherlock/core/layer.py index 2d102fc1c..83abf416e 100644 --- a/src/ansys/sherlock/core/layer.py +++ b/src/ansys/sherlock/core/layer.py @@ -2161,6 +2161,7 @@ def update_test_points( >>> from ansys.sherlock.core.launcher import launch_sherlock >>> from ansys.sherlock.core.types.layer_types import UpdateTestPointsRequest, >>> TestPointProperties + >>> from ansys.api.sherlock.v0 import SherlockLayerService_pb2 >>> sherlock = connect() >>> test_point = TestPointProperties( >>> id="TP1", @@ -2169,7 +2170,7 @@ def update_test_points( >>> center_x=1.0, >>> center_y=0.5, >>> radius=0.2, - >>> load_type="Force", + >>> load_type=SherlockLayerService_pb2.TestPointProperties.LoadType.Force, >>> load_value=3.0, >>> load_units="ozf", >>> ) diff --git a/src/ansys/sherlock/core/types/layer_types.py b/src/ansys/sherlock/core/types/layer_types.py index 47089e75f..ea9547d3a 100644 --- a/src/ansys/sherlock/core/types/layer_types.py +++ b/src/ansys/sherlock/core/types/layer_types.py @@ -421,7 +421,7 @@ class TestPointProperties(BaseModel): """Center y-value""" radius: float """Radius""" - load_type: str + load_type: SherlockLayerService_pb2.TestPointProperties.LoadType.ValueType """Load type""" load_value: float """Load value""" diff --git a/tests/test_layer.py b/tests/test_layer.py index 597a301a4..56c8dee33 100644 --- a/tests/test_layer.py +++ b/tests/test_layer.py @@ -5,6 +5,7 @@ import platform import uuid +from ansys.api.sherlock.v0 import SherlockLayerService_pb2 import grpc import pydantic import pytest @@ -1870,7 +1871,7 @@ def helper_test_update_test_points(layer): center_x=1.0, center_y=0.5, radius=0.2, - load_type="Force", + load_type=SherlockLayerService_pb2.TestPointProperties.LoadType.Force, load_value=3.0, load_units="ozf", ) @@ -1882,7 +1883,7 @@ def helper_test_update_test_points(layer): center_x=-30, center_y=-10, radius=5, - load_type="Displacement", + load_type=SherlockLayerService_pb2.TestPointProperties.LoadType.Displacement, load_value=0, load_units="in", ) @@ -1894,7 +1895,7 @@ def helper_test_update_test_points(layer): center_x=60, center_y=-40, radius=4, - load_type="Force", + load_type=SherlockLayerService_pb2.TestPointProperties.LoadType.Force, load_value=5, load_units="N", ) diff --git a/tests/test_utils.py b/tests/test_utils.py index 490afb186..ab0411b36 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -27,7 +27,7 @@ def test_version_check(): def assert_float_equals(expected, actual): - assert pytest.approx(expected, abs=1e-14) == pytest.approx(actual, abs=1e-14) + assert pytest.approx(actual, abs=1e-14) == pytest.approx(expected, abs=1e-14) if __name__ == "__main__":