Skip to content

Commit

Permalink
Add tolerances to testing
Browse files Browse the repository at this point in the history
  • Loading branch information
isteinbrecher committed Feb 11, 2025
1 parent cd4a7f8 commit 1dbeb5a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/test_create_cubit_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
create_tube_tutorial,
)

# Tolerances to be used for the assert_results_equal functions in this file
ASSERT_RESULTS_EQUAL_TOL = {"atol": 1e-13, "rtol": 1e-13}


@pytest.mark.cubitpy
def test_create_cubit_input_tube(
Expand All @@ -48,7 +51,9 @@ def test_create_cubit_input_tube(

file_path = tmp_path / (current_test_name + ".dat")
create_tube(file_path)
assert_results_equal(file_path, get_corresponding_reference_file_path())
assert_results_equal(
file_path, get_corresponding_reference_file_path(), **ASSERT_RESULTS_EQUAL_TOL
)


@pytest.mark.cubitpy
Expand All @@ -66,7 +71,7 @@ def test_create_cubit_input_tutorial(
tutorial_path = (
reference_file_directory.parents[1] / "tutorial" / "4C_input_solid_tutorial.dat"
)
assert_results_equal(tutorial_path, result_path)
assert_results_equal(tutorial_path, result_path, **ASSERT_RESULTS_EQUAL_TOL)


@pytest.mark.cubitpy
Expand All @@ -80,7 +85,9 @@ def test_create_cubit_input_block(

file_path = tmp_path / (current_test_name + ".dat")
create_block(file_path)
assert_results_equal(file_path, get_corresponding_reference_file_path())
assert_results_equal(
file_path, get_corresponding_reference_file_path(), **ASSERT_RESULTS_EQUAL_TOL
)


@pytest.mark.cubitpy
Expand All @@ -102,4 +109,5 @@ def test_create_cubit_input_solid_shell(
assert_results_equal(
file_path_dome,
get_corresponding_reference_file_path(additional_identifier="dome"),
**ASSERT_RESULTS_EQUAL_TOL,
)

0 comments on commit 1dbeb5a

Please sign in to comment.