File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ def _signature_matches_extension(filename):
53
53
try :
54
54
with open (filename , "rb" ) as fh :
55
55
found_signature = fh .read (len (expected_signature ))
56
- except Exception :
56
+ except OSError :
57
57
return False , f"Could not read file: { filename } "
58
58
if found_signature == expected_signature :
59
59
return True , ""
Original file line number Diff line number Diff line change @@ -78,14 +78,14 @@ def test_load_empty_image():
78
78
79
79
@pytest .mark .parametrize ("extension" , [".gz" , ".bz2" ])
80
80
def test_load_bad_compressed_extension (tmp_path , extension ):
81
- file_path = tmp_path . joinpath ( f"img.nii{ extension } " )
81
+ file_path = tmp_path / f"img.nii{ extension } "
82
82
file_path .write_bytes (b"bad" )
83
83
with pytest .raises (ImageFileError , match = ".*is not a .* file" ):
84
84
load (file_path )
85
85
86
86
87
87
def test_load_file_that_cannot_be_read (tmp_path ):
88
- subdir = tmp_path . joinpath ( "img.nii.gz" )
88
+ subdir = tmp_path / "img.nii.gz"
89
89
subdir .mkdir ()
90
90
with pytest .raises (ImageFileError , match = "Could not read" ):
91
91
load (subdir )
You can’t perform that action at this time.
0 commit comments