From 7165790202459ebfbbd4b01b54bd03edfc5d5913 Mon Sep 17 00:00:00 2001 From: Lachlan Grose Date: Fri, 15 Mar 2024 14:12:23 +1100 Subject: [PATCH] fix: atol for isclose --- tests/unit/modelling/test_structural_frame.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/unit/modelling/test_structural_frame.py b/tests/unit/modelling/test_structural_frame.py index c63463ff7..e454756e6 100644 --- a/tests/unit/modelling/test_structural_frame.py +++ b/tests/unit/modelling/test_structural_frame.py @@ -1,3 +1,4 @@ +from math import atan from LoopStructural.modelling.features import ( StructuralFrame, GeologicalFeature, @@ -65,9 +66,16 @@ def test_create_structural_frame_pli(): "fault", 10, nelements=2000, steps=4, interpolatortype="PLI", buffer=2 ) model.update() - assert np.all(np.isclose(fault[0].evaluate_gradient(np.array([[5, 5, 5]])), [0, 0, 1])) - assert np.all(np.isclose(fault[1].evaluate_gradient(np.array([[5, 5, 5]])), [0, 1, 0])) - assert np.all(np.isclose(fault[2].evaluate_gradient(np.array([[5, 5, 5]])), [1, 0, 0])) + + assert np.all( + np.isclose(fault[0].evaluate_gradient(np.array([[5, 5, 5]])), [0, 0, 1], atol=1e-4) + ) + assert np.all( + np.isclose(fault[1].evaluate_gradient(np.array([[5, 5, 5]])), [0, 1, 0], atol=1e-4) + ) + assert np.all( + np.isclose(fault[2].evaluate_gradient(np.array([[5, 5, 5]])), [1, 0, 0], atol=1e-4) + ) if __name__ == "__main__":