Skip to content

Commit 545cd87

Browse files
yibeichanclaude
andcommitted
Fix failing tests by adding JSON-LD flag and correcting mock patches
- Add -j flag to NIDM conversion command when output is .json-ld format - Fix mock patching in test_wrapper.py to patch ants.image_write at the correct import location (src.antspy.wrapper.ants.image_write) - All 13 tests now pass successfully 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0587551 commit 545cd87

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/run.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,11 @@ def nidm_conversion(logger, derivatives_dir, nidm_dir, bids_subject, nidm_input_
225225
"-subjid", f"sub-{bids_subject}",
226226
"-o", nidm_output
227227
]
228-
228+
229+
# Add JSON-LD flag if output format is JSON-LD
230+
if nidm_output.endswith('.json-ld'):
231+
cmd.append("-j")
232+
229233
logger.info(f"Converting segmentation to NIDM for {log_prefix}")
230234
logger.info(f"Running command: {' '.join(cmd)}")
231235

tests/test_wrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def test_organize_bids_output_single_session(self):
138138
'probabilityimages': [mock_prob1, mock_prob2, mock_prob3]
139139
}
140140

141-
with patch('ants.image_write') as mock_write:
141+
with patch('src.antspy.wrapper.ants.image_write') as mock_write:
142142
# Call the method
143143
result = self.segmenter._organize_bids_output(segmentation_results, "01")
144144

@@ -195,7 +195,7 @@ def test_organize_bids_output_with_session(self):
195195
'probabilityimages': []
196196
}
197197

198-
with patch('ants.image_write') as mock_write:
198+
with patch('src.antspy.wrapper.ants.image_write') as mock_write:
199199
# Call the method with session
200200
result = self.segmenter._organize_bids_output(segmentation_results, "01", "01")
201201

0 commit comments

Comments
 (0)