diff --git a/tests/test_fsl_utils_path.py b/tests/test_fsl_utils_path.py index fe1380a99554b2dad86659567971cfb55a6a556e..9a567396f6ea119cd6488c058fb05fe6e4a231ca 100644 --- a/tests/test_fsl_utils_path.py +++ b/tests/test_fsl_utils_path.py @@ -110,6 +110,20 @@ def test_shallowest(): assert fslpath.shallowest(path, suffixes) == output +def test_hasExt(): + + tests = [ + ('file.nii', ['.nii', '.gz'], True), + ('file.nii.gz', ['.nii'], False), + ('file.nii.gz', ['.nii', '.gz'], True), + ('file.nii.gz', ['.nii.gz'], True), + ('file.txt', ['.nii', '.gz'], False), + ] + + for path, aexts, expected in tests: + assert fslpath.hasExt(path, aexts) == expected + + def test_addExt_imageFiles_mustExist_shouldPass(): """Tests the addExt function where the path exists, and the inputs are valid.