Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions package/src/pyaslreport/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ def get_bids_metadata(data):
dicom_header = get_dicom_header(dicom_dir)
sequence = get_sequence(modality, dicom_header)

if sequence is None:
raise ValueError(f"No matching sequence found for modality '{modality}' with the provided DICOM header")

return sequence.extract_bids_metadata()


Expand Down
6 changes: 3 additions & 3 deletions package/src/pyaslreport/tests/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ def test_get_bids_metadata_no_sequence():
data = {"modality": "asl", "dicom_dir": "/fake/dir"}
fake_header = MagicMock()
with patch("pyaslreport.main.get_dicom_header", return_value=fake_header), \
patch("pyaslreport.main.get_sequence", return_value=None):
patch("pyaslreport.main.get_sequence", side_effect=ValueError("No ASL sequence class found")):
with pytest.raises(ValueError) as exc:
get_bids_metadata(data)
assert "No matching sequence found" in str(exc.value)
assert "No ASL sequence class found" in str(exc.value)

def test_get_bids_metadata_invalid_modality():
data = {"modality": None, "dicom_dir": "/fake/dir"}
fake_header = MagicMock()
with patch("pyaslreport.main.get_dicom_header", return_value=fake_header), \
patch("pyaslreport.main.get_sequence", return_value=None):
patch("pyaslreport.main.get_sequence", side_effect=ValueError("Unsupported modality")):
with pytest.raises(ValueError):
get_bids_metadata(data)