From 5cc07cf2ed2a6545789aca771bdc6d6ab5a56b15 Mon Sep 17 00:00:00 2001 From: Viktor Plattner Date: Fri, 16 Feb 2024 10:53:10 +0000 Subject: [PATCH] writing docstrings to explain the behaviour of the test functions --- tests/test_unit/test_validation.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/test_unit/test_validation.py b/tests/test_unit/test_validation.py index 1093727..1426242 100644 --- a/tests/test_unit/test_validation.py +++ b/tests/test_unit/test_validation.py @@ -78,13 +78,17 @@ def test_validate_mesh_structure_pairs_no_obj(atlas): when there is at least one structure in the atlas that doesn't have a corresponding obj file. - True for: allen_mouse_100um (structure 545 doesn't have an obj file) - False for: admba_3d_e11_5_mouse_16um (it has all pairs) + Expected behaviour: + True for "allen_mouse_10um" (structure 545 doesn't have an obj file): fails + the validation function, raises an error --> no output from this test function + + False for "admba_3d_e11_5_mouse_16um" (it has all pairs): no error is + raised by the validation function --> this test function catches it """ with pytest.raises( AssertionError, - match="Structures with ID \[.*\] are in the atlas, but don't have a corresponding mesh file", + match=r"Structures with ID \[.*?\] are in the atlas, but don't have a corresponding mesh file;", ): validate_mesh_structure_pairs(atlas) @@ -93,9 +97,13 @@ def test_validate_mesh_structure_pairs_not_in_atlas(atlas): """ Tests if validate_mesh_structure_pairs function raises an error, when there is at least one orphan obj file (doesn't have a corresponding structure in the atlas) + + Expected behaviour: + Currently no atlas fails the validation function this way so the [] is always empty + --> this test function should always raise an error """ with pytest.raises( AssertionError, - match="Structures with IDs \[.*\] have a mesh file, but are not accessible through the atlas", + match=r"Structures with IDs \[.*?\] have a mesh file, but are not accessible through the atlas.", ): validate_mesh_structure_pairs(atlas)