11import pytest
22from unittest .mock import patch , MagicMock
3- from .main import get_bids_metadata
3+ from pyaslreport .main import get_bids_metadata
44
55# filepath: /home/ibrahim/MyPc/Projects/GSoC/ASL-Parameter-Generator/package/src/pyaslreport/test_main.py
66
@@ -24,15 +24,16 @@ def test_get_bids_metadata_no_sequence():
2424 data = {"modality" : "asl" , "dicom_dir" : "/fake/dir" }
2525 fake_header = MagicMock ()
2626 with patch ("pyaslreport.main.get_dicom_header" , return_value = fake_header ), \
27- patch ("pyaslreport.main.get_sequence" , return_value = None ):
27+ patch ("pyaslreport.main.get_sequence" , side_effect = ValueError ( "No ASL sequence class found that matches the DICOM header" ) ):
2828 with pytest .raises (ValueError ) as exc :
2929 get_bids_metadata (data )
30- assert "No matching sequence found" in str (exc .value )
30+ assert "No ASL sequence class found" in str (exc .value )
3131
3232def test_get_bids_metadata_invalid_modality ():
3333 data = {"modality" : None , "dicom_dir" : "/fake/dir" }
3434 fake_header = MagicMock ()
3535 with patch ("pyaslreport.main.get_dicom_header" , return_value = fake_header ), \
36- patch ("pyaslreport.main.get_sequence" , return_value = None ):
37- with pytest .raises (ValueError ):
38- get_bids_metadata (data )
36+ patch ("pyaslreport.main.get_sequence" , side_effect = ValueError ("Unsupported modality: None" )):
37+ with pytest .raises (ValueError ) as exc :
38+ get_bids_metadata (data )
39+ assert "Unsupported modality" in str (exc .value )
0 commit comments