Skip to content

Commit

Permalink
TEST: Expected behavior with safe and unsafe bids_ids
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Jun 6, 2024
1 parent c674fc1 commit fb55b65
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions sdcflows/tests/test_fieldmaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def test_FieldmapEstimation(dsA_dir, inputfiles, method, nsources, raises):
assert fe.method == method
assert len(fe.sources) == nsources
assert fe.bids_id is not None and fe.bids_id.startswith("auto_")
assert fe.bids_id == fe.sanitized_id # Auto-generated IDs are sanitized

# Attempt to change bids_id
with pytest.raises(ValueError):
Expand Down Expand Up @@ -243,6 +244,33 @@ def test_FieldmapEstimationIdentifier(monkeypatch, dsA_dir):

fm.clear_registry()

fe = fm.FieldmapEstimation(
[
fm.FieldmapFile(
dsA_dir / "sub-01" / "fmap/sub-01_fieldmap.nii.gz",
metadata={
"Units": "Hz",
"B0FieldIdentifier": "fmap-with^special#chars",
"IntendedFor": ["file1.nii.gz", "file2.nii.gz"],
},
),
fm.FieldmapFile(
dsA_dir / "sub-01" / "fmap/sub-01_magnitude.nii.gz",
metadata={"Units": "Hz", "B0FieldIdentifier": "fmap-with^special#chars"},
),
]
)
assert fe.bids_id == "fmap-with^special#chars"
assert fe.sanitized_id == "fmap_with_special_chars"
# The unsanitized ID is used for lookups
assert fm.get_identifier("file1.nii.gz") == ("fmap-with^special#chars",)
assert fm.get_identifier("file2.nii.gz") == ("fmap-with^special#chars",)

wf = fe.get_workflow()
assert wf.name == "wf_fmap_with_special_chars"

fm.clear_registry()


def test_type_setter():
"""Cover the _type_setter routine."""
Expand Down

0 comments on commit fb55b65

Please sign in to comment.